+

CN114445220A - Transaction data clearing method and device, database server and storage medium - Google Patents

Transaction data clearing method and device, database server and storage medium Download PDF

Info

Publication number
CN114445220A
CN114445220A CN202011214451.7A CN202011214451A CN114445220A CN 114445220 A CN114445220 A CN 114445220A CN 202011214451 A CN202011214451 A CN 202011214451A CN 114445220 A CN114445220 A CN 114445220A
Authority
CN
China
Prior art keywords
clearing
transaction
transaction data
cleared
period
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011214451.7A
Other languages
Chinese (zh)
Other versions
CN114445220B (en
Inventor
杨延超
胡冀旋
蔺荻
张群
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NetsUnion Clearing Corp
Original Assignee
NetsUnion Clearing Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NetsUnion Clearing Corp filed Critical NetsUnion Clearing Corp
Priority to CN202011214451.7A priority Critical patent/CN114445220B/en
Priority to PCT/CN2021/111006 priority patent/WO2022095525A1/en
Publication of CN114445220A publication Critical patent/CN114445220A/en
Application granted granted Critical
Publication of CN114445220B publication Critical patent/CN114445220B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

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

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请公开了交易数据的清分方法、装置、数据库服务器及存储介质。其中方法包括利用多个清分期对一个交易批次内的交易数据进行清分;其中,在各清分期中,确定交易数据库中与所述交易批次相对应的待清分交易数据;利用所述清分期内的多个清分执行期,对所述待清分交易数据分别进行清分,其中,每个清分执行期内清分的交易数据量不大于第一阈值。该技术方案将一个交易批次内的待清分交易数据利用多个清分期而非单一的清分期进行处理,并限定每个清分执行期可清分的交易数据量上限,从而避免了清分执行期内清分的交易数据量过高,并且不需要在交易数据库之外单独架设清分数据库,节约了硬件成本,同时还使得数据库主备同步的延迟得到了降低。

Figure 202011214451

The present application discloses a method, device, database server and storage medium for sorting transaction data. The method includes using multiple clearing periods to clear the transaction data in a transaction batch; wherein, in each clearing period, determine the transaction data to be cleared corresponding to the transaction batch in the transaction database; In a plurality of clearing execution periods within the clearing and clearing period, the transaction data to be cleared is cleared respectively, wherein the amount of cleared transaction data in each clearing execution period is not greater than a first threshold. The technical solution processes the transaction data to be cleared in a transaction batch using multiple clearing periods instead of a single clearing period, and limits the upper limit of the transaction data that can be cleared in each clearing execution period, thereby avoiding clearing The amount of transaction data cleared during the sub-execution period is too high, and there is no need to set up a separate clearing database outside the transaction database, which saves hardware costs and reduces the delay of database master-standby synchronization.

Figure 202011214451

Description

交易数据的清分方法、装置、数据库服务器及存储介质Transaction data sorting method, device, database server and storage medium

技术领域technical field

本申请涉及计算机技术领域,尤其涉及交易数据的清分方法、装置、数据库服务器及存储介质。The present application relates to the field of computer technology, and in particular, to a method, device, database server and storage medium for sorting transaction data.

背景技术Background technique

清分(Clearing)是清算的数据准备阶段,主要是将当日的全部交易数据按照各成员行之间本代他、他代本、贷记、借记、笔数、金额、轧差净额等进行汇总、整理、分类。Clearing is the data preparation stage of clearing, which mainly refers to all the transaction data of the day according to each member bank's current, other, credit, debit, number of transactions, amount, net balance, etc. Summarize, organize, and categorize.

目前,清分过程中存在数据库瞬时TPS(Transaction Per Second,每秒处理交易数据量)过高的技术问题,亟待解决。At present, there is a technical problem that the instantaneous TPS (Transaction Per Second, the amount of transaction data processed per second) of the database is too high during the sorting process, which needs to be solved urgently.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供了交易数据的清分方法、装置、数据库服务器及存储介质,以避免交易数据库瞬时TPS过高的问题。The embodiments of the present application provide a method, device, database server, and storage medium for sorting transaction data, so as to avoid the problem that the instantaneous TPS of the transaction database is too high.

本申请实施例采用下述技术方案:The embodiment of the present application adopts the following technical solutions:

第一方面,本申请实施例提供一种交易数据的清分方法,由数据库服务器执行,包括:利用多个清分期对一个交易批次内的交易数据进行清分;其中,在各清分期中,确定交易数据库中与所述交易批次相对应的待清分交易数据;利用所述清分期内的多个清分执行期,对所述待清分交易数据分别进行清分,其中,每个清分执行期内清分的交易数据量不大于第一阈值。In a first aspect, an embodiment of the present application provides a method for sorting transaction data, which is executed by a database server and includes: sorting the transaction data in a transaction batch by using a plurality of clearing periods; wherein, in each clearing period , determine the transaction data to be cleared corresponding to the transaction batch in the transaction database; use multiple clearing execution periods in the clearing period to clear the transaction data to be cleared respectively, wherein each The amount of transaction data cleared during the clearing execution period is not greater than the first threshold.

可选地,所述确定交易数据库中与所述交易批次相对应的待清分交易数据包括:根据与所述交易批次相对应的交易时间条件,从所述交易数据库中查询出交易时间与所述交易时间条件匹配、处于交易终态且未完成清分的交易数据,作为与所述交易批次相对应的待清分交易数据。Optionally, the determining the transaction data to be cleared corresponding to the transaction batch in the transaction database includes: querying the transaction time from the transaction database according to the transaction time condition corresponding to the transaction batch. The transaction data that matches the transaction time conditions, is in the final state of the transaction and has not been cleared, is used as the transaction data to be cleared corresponding to the transaction batch.

可选地,所述从所述交易数据库中查询出交易时间与所述交易时间条件匹配、处于交易终态且未完成清分的交易数据,作为待清分交易数据包括:根据交易数据的交易状态标识确定处于交易终态的交易数据,以及根据交易数据的清分标识确定未完成清分的交易数据。Optionally, the transaction data whose transaction time matches the transaction time conditions, is in the final state of the transaction and has not been cleared, is queried from the transaction database, and the transaction data to be cleared includes: the transaction data according to the transaction data. The status flag determines the transaction data in the final state of the transaction, and determines the transaction data that has not been cleared according to the clearing flag of the transaction data.

可选地,所述利用所述清分期内的多个清分执行期,对所述待清分交易数据分别进行清分包括:在清分执行期内,逐条对待清分交易数据进行清分,并累计本清分执行期内已清分的交易数据量;在累计的交易数据量达到第一阈值,或者所有待清分交易数据均已清分完毕的情况下,终止本清分执行期的清分。Optionally, using a plurality of clearing execution periods within the clearing period to respectively clear the transaction data to be cleared includes: during the clearing execution period, clearing the transaction data to be cleared one by one. , and accumulate the transaction data volume cleared during this clearing execution period; when the accumulated transaction data volume reaches the first threshold, or all the transaction data to be cleared have been cleared, the clearing execution period will be terminated clearing.

可选地,所述方法还包括:在清分执行期内,成批次地确定已完成清分的交易数据的清分标识。Optionally, the method further includes: determining, in batches, the clearing identifiers of the transaction data that have been cleared during the clearing execution period.

可选地,所述成批次地确定已完成清分的交易数据的清分标识包括:累计已完成清分但未确定清分标识的交易数据量,在累计的交易数据量达到第二阈值的情况下,为已完成清分但未确定清分标识的交易数据批量确定清分标识,并在确定清分标识后,将累计的交易数据量清零。Optionally, the determining in batches the clearing identifiers of the transaction data that have been cleared includes: accumulating the amount of transaction data for which clearing has been completed but the clearing identifier has not been determined, and when the accumulated transaction data amount reaches the second threshold. In the case of , the clearing identifier is determined in batches for the transaction data that has been cleared but the clearing identifier has not been determined, and after the clearing identifier is determined, the accumulated transaction data volume is cleared to zero.

可选地,各所述清分执行期的最大可执行时长相同,所述利用所述清分期内的多个清分执行期,对所述待清分交易数据分别进行清分包括:在清分执行期内,利用清分线程对待清分交易数据进行清分,并统计清分的总时长;若所述总时长小于所述最大可执行时长,则根据所述总时长和所述最大执行时长确定休眠时长,使所述清分线程根据所述休眠时长进行休眠。Optionally, the maximum executable duration of each clearing execution period is the same, and the clearing of the transaction data to be cleared by using a plurality of clearing execution periods in the clearing period includes: During the execution period, use the clearing thread to clear the transaction data to be cleared, and count the total time of clearing; if the total time is less than the maximum executable time The duration determines the sleep duration, so that the clearing thread sleeps according to the sleep duration.

可选地,单个清分期内的多个清分执行期的总时长不大于第三阈值。Optionally, the total duration of multiple clearing execution periods in a single clearing period is not greater than the third threshold.

可选地,所述方法还包括:接收第一清分任务,所述第一清分任务对应于所述交易批次;所述第一清分任务的首次执行时间是根据所述交易批次的起始交易时间和第一延迟时间确定的;根据所述第一清分任务的首次执行时间开启该交易批次的首个清分期,并在每个清分期内分别执行所述第一清分任务,以实现利用多个清分期进行清分的步骤。Optionally, the method further includes: receiving a first clearing task, the first clearing task corresponding to the transaction batch; the first execution time of the first clearing task is based on the transaction batch The first clearing period of the transaction batch is opened according to the first execution time of the first clearing task, and the first clearing period is executed in each clearing period. Divide tasks to implement clearing steps using multiple clearing periods.

可选地,所述方法还包括:接收第二清分任务,所述第二清分任务对应于所述交易批次,所述第二清分任务的执行时间是根据所述交易批次的起始交易时间和第二延迟时间确定的;根据所述第二清分任务的执行时间,执行所述第二清分任务,对所述交易批次的所有未完成清分的交易数据进行清分。Optionally, the method further includes: receiving a second clearing task, the second clearing task corresponds to the transaction batch, and the execution time of the second clearing task is based on the transaction batch The starting transaction time and the second delay time are determined; according to the execution time of the second clearing task, the second clearing task is executed, and all the transaction data of the transaction batch that have not been cleared are cleared. point.

第二方面,本申请实施例还提供一种交易数据的清分装置,用于实现如上任一所述的交易数据的清分方法。In a second aspect, an embodiment of the present application further provides an apparatus for sorting transaction data, which is used to implement the method for sorting transaction data as described above.

第三方面,本申请实施例还提供一种数据库服务器,包括:处理器;以及被安排成存储计算机可执行指令的存储器,可执行指令在被执行时使处理器执行如上任一所述的交易数据的清分方法。In a third aspect, embodiments of the present application further provide a database server, including: a processor; and a memory arranged to store computer-executable instructions, the executable instructions, when executed, cause the processor to execute any of the transactions described above Data sorting method.

第四方面,本申请实施例还提供一种计算机可读存储介质,计算机可读存储介质存储一个或多个程序,一个或多个程序当被包括多个应用程序的数据库服务器执行时,使得数据库服务器执行如上任一所述的交易数据的清分方法。In a fourth aspect, embodiments of the present application further provide a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, and the one or more programs, when executed by a database server including multiple application programs, make the database The server executes the clearing method of transaction data as described in any of the above.

本申请实施例采用的上述至少一个技术方案能够达到以下有益效果:将一个交易批次内的待清分交易数据利用多个清分期而非单一的清分期进行处理,并限定每个清分执行期可清分的交易数据量上限,从而避免了清分执行期内清分的交易数据量过高,并且不需要在交易数据库之外单独架设清分数据库,节约了硬件成本,同时还使得数据库主备同步的延迟得到了降低。The above-mentioned at least one technical solution adopted in the embodiments of the present application can achieve the following beneficial effects: the transaction data to be cleared in a transaction batch is processed using multiple clearing periods instead of a single clearing period, and the execution of each clearing is limited. The upper limit of the transaction data volume that can be cleared during the period, thus avoiding the excessive transaction data volume cleared during the clearing execution period, and it is not necessary to set up a clearing database separately from the transaction database, which saves hardware costs, and also makes the database The latency of master-slave synchronization has been reduced.

附图说明Description of drawings

此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described herein are used to provide further understanding of the present application and constitute a part of the present application. The schematic embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation of the present application. In the attached image:

图1示出了根据本申请一个实施例的交易清分方法的流程示意图;FIG. 1 shows a schematic flowchart of a transaction clearing method according to an embodiment of the present application;

图2示出的是现有技术中利用单一清分期集中清分的清分TPS示意图;Figure 2 shows a schematic diagram of a clearing TPS in the prior art utilizing a single clearing period for centralized clearing;

图3示出的是根据本申请一个实施例的利用多个清分期进行清分的清分TPS示意图;FIG. 3 shows a schematic diagram of a clearing TPS for clearing by using multiple clearing periods according to an embodiment of the present application;

图4示出了根据本申请一个实施例的交易清分装置的结构示意图;FIG. 4 shows a schematic structural diagram of a transaction sorting device according to an embodiment of the present application;

图5示出了本申请实施例中一种数据库服务器的结构示意图。FIG. 5 shows a schematic structural diagram of a database server in an embodiment of the present application.

具体实施方式Detailed ways

为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请具体实施例及相应的附图对本申请技术方案进行清楚、完整地描述。显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the objectives, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be clearly and completely described below with reference to the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

为了解决背景技术部分所提出的问题,一种实施方式是通过增设硬件资源来解决。具体来说,除了将交易数据保存到交易数据库之外,还单独增设一个清分数据库来存储,这样即使清分数据库的TPS过高,也不会影响交易数据库的正常使用,也是一种可以接受的做法。In order to solve the problem raised in the background section, an implementation manner is to solve the problem by adding hardware resources. Specifically, in addition to saving the transaction data in the transaction database, a separate clearing database is also added for storage, so that even if the TPS of the clearing database is too high, it will not affect the normal use of the transaction database, which is acceptable. way of doing.

然而,这无疑就大幅提升了硬件成本,因为为了确保数据的安全性,数据库通常为主备架构,即一个数据库具有多个用于同步备份的备数据库,这些备数据库还可能设置在不同城市,以实现异地容灾。However, this undoubtedly greatly increases the hardware cost, because in order to ensure the security of the data, the database usually has a master-standby architecture, that is, a database has multiple standby databases for synchronous backup, and these standby databases may also be set in different cities. To achieve remote disaster recovery.

通过分析发现,交易数据的清分所导致的数据库TPS过高,主要是因为清分通常是在较短的时间内完成的,以避免对数据库的过度利用,例如,9点至10点的交易数据(以交易时间为准),通常在10点20之后的短时间(例如3分钟)内来进行清分,一方面是业务上将9点至10点作为一个交易批次,以交易批次为单位进行交易数据的清分,条理性好,另一方面由于网上交易的特点,如果交易未成功,需要进行冲正等处理,在产生交易数据后不能立即进行清分。Through analysis, it is found that the TPS of the database caused by the clearing of transaction data is too high, mainly because the clearing is usually completed in a short period of time to avoid excessive utilization of the database, for example, transactions from 9:00 to 10:00 The data (subject to the transaction time) is usually sorted within a short time after 10:20 (for example, 3 minutes). The clearing of transaction data for the unit is well organized. On the other hand, due to the characteristics of online transactions, if the transaction is unsuccessful, it needs to be processed such as reversal, and the clearing cannot be performed immediately after the transaction data is generated.

另外,由于上述原因,还使得数据库同步的数据量过大,使得在清分过程中,数据库同步的延迟较高,影响稳定性。In addition, due to the above reasons, the amount of data to be synchronized in the database is too large, so that during the sorting process, the delay of the database synchronization is relatively high, which affects the stability.

对此,本申请的技术构思在于,避免将一个交易批次内的交易数据的清分利用集中的时间段来处理,而是利用多个时间分片来实现,从而将交易数据化整为零,实现了数据库利用的削峰填谷。同时由于每个时间分片内需要清分的数据量通常不会很多,因此可以设置一个清分的交易数据量上限,避免对交易数据库进行过多的占用。In this regard, the technical idea of the present application is to avoid using a centralized time period to process the clearing of transaction data in a transaction batch, but to use multiple time slices to realize the transaction data into zero. , to realize the peak-shaving and valley-filling of database utilization. At the same time, since the amount of data that needs to be cleared in each time shard is usually not a lot, it is possible to set an upper limit on the amount of cleared transaction data to avoid excessive occupation of the transaction database.

以下结合附图,详细说明本申请各实施例提供的技术方案。The technical solutions provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

图1示出了根据本申请一个实施例的交易清分方法的流程示意图,该方法可以由数据库服务器执行,该数据库服务器可以是交易数据库的数据库服务器。另一方面。由于交易数据的数据量非常大,单个交易数据库可能难以应对高并发,一般在实践中往往利用多个IDC(Internet Data Center,互联网数据中心),在每个IDC中部署若干个交易数据库,执行本申请的交易清分方法的数据库服务器可以是一个IDC中交易数据库的数据库服务器。FIG. 1 shows a schematic flowchart of a transaction sorting method according to an embodiment of the present application. The method may be executed by a database server, and the database server may be a database server of a transaction database. on the other hand. Due to the large amount of transaction data, it may be difficult for a single transaction database to handle high concurrency. In practice, multiple IDCs (Internet Data Center, Internet Data Center) are often used, and several transaction databases are deployed in each IDC. The database server of the applied transaction sorting method may be a database server of a transaction database in an IDC.

本申请实施例中交易数据的清分方法可以利用多个清分期对一个交易批次内的交易数据进行清分,各清分期内进行的交易数据的清分均可参照图1所示的流程来实现。每个清分期可以理解为一个时间分片,即并不是在一个较短的时间段内集中清分一个交易批次内所有的交易数据。The transaction data sorting method in the embodiment of the present application may use multiple clearing periods to clear the transaction data in a transaction batch, and the clearing of the transaction data in each clearing period can refer to the process shown in FIG. 1 . to fulfill. Each clearing period can be understood as a time slicing, that is, not all transaction data in a transaction batch are centrally cleared in a short period of time.

交易批次可以根据交易时间来划分,例如8点至9点之间产生的交易数据为09批次。在其他实施例中还可以根据交易流水号等进行交易批次的划分。Transaction batches can be divided according to transaction time. For example, the transaction data generated between 8:00 and 9:00 is 09 batches. In other embodiments, transaction batches may also be divided according to transaction serial numbers and the like.

如图1所示,在清分期内执行的交易数据的清分方法包括:As shown in Figure 1, the clearing method of transaction data executed during the clearing period includes:

步骤S110,确定交易数据库中与交易批次相对应的待清分交易数据。Step S110: Determine the transaction data to be sorted corresponding to the transaction batch in the transaction database.

这里可以看出,本申请的技术方案直接在交易数据库中确定待清分交易数据,而不需要单独设置一个清分数据库,也就实现了交易数据库的复用,从而节约了硬件成本和运维成本。It can be seen here that the technical solution of the present application directly determines the transaction data to be sorted in the transaction database, and does not need to set up a separate sorting database, which realizes the multiplexing of the transaction database, thereby saving hardware costs and operation and maintenance. cost.

步骤S120,利用清分期内的多个清分执行期,对待清分交易数据分别进行清分,其中,每个清分执行期内清分的交易数据量不大于第一阈值。Step S120 , clearing the transaction data to be cleared separately by using a plurality of clearing execution periods in the clearing period, wherein the amount of transaction data cleared in each clearing execution period is not greater than a first threshold.

在清分期中使用多个清分执行期,通过预设的第一阈值来对每个时间分片内可清分的交易数据进行限制,避免了对交易数据库的过度利用,也能够确保交易数据都能够及时地得到清分。也正由于这样,每次需要同步的数据量并不多,从而改善了同步延迟的问题。In the clearing period, multiple clearing execution periods are used to limit the clearable transaction data in each time slice through the preset first threshold, which avoids excessive use of the transaction database and ensures that the transaction data can be sorted out in a timely manner. Because of this, the amount of data that needs to be synchronized each time is not much, thus improving the problem of synchronization delay.

需要说明的是,这里的清分策略可以根据业务需求实现,例如进行汇总、分类等,只要交易数据记载的交易内容能够支持清分策略即可。It should be noted that the clearing strategy here can be implemented according to business needs, such as summarizing, classifying, etc., as long as the transaction content recorded in the transaction data can support the clearing strategy.

清分执行期和清分期的时长,以及第一阈值可以根据需求设置,例如清分执行期设置为1秒,清分期设置为5分钟,第一阈值设置为5200条。The clearing execution period, the clearing period duration, and the first threshold can be set as required. 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 entries.

可见,图1所示的方法,将一个交易批次内的待清分交易数据利用多个清分期而非单一的清分期进行处理,并限定每个清分执行期可清分的交易数据量上限,从而避免了清分执行期内清分的交易数据量过高,并且不需要在交易数据库之外单独架设清分数据库,节约了硬件成本,同时还使得数据库主备同步的延迟得到了降低。It can be seen that the method shown in Figure 1 uses multiple clearing periods instead of a single clearing period to process the transaction data to be cleared in a transaction batch, and limits the amount of transaction data that can be cleared in each clearing execution period The upper limit, which avoids the excessive transaction data volume cleared during the clearing execution period, and does not require a separate clearing database outside the transaction database, which saves hardware costs and reduces the delay of database master/standby synchronization. .

在本申请的一个实施例中,上述方法中,确定交易数据库中与交易批次相对应的待清分交易数据包括:根据与交易批次相对应的交易时间条件,从交易数据库中查询出交易时间与交易时间条件匹配、处于交易终态且未完成清分的交易数据,作为与交易批次相对应的待清分交易数据。In an embodiment of the present application, in the above method, determining the pending transaction data corresponding to the transaction batch in the transaction database includes: querying the transaction database from the transaction database according to the transaction time condition corresponding to the transaction batch The transaction data whose time matches the transaction time conditions, is in the final state of the transaction and has not been cleared, is regarded as the pending transaction data corresponding to the transaction batch.

交易在正式完成后,交易数据就会呈交易终态,也就不会在交易内容上改变,此时就可以进行清分。而从交易数据的产生到最终达到交易终态,需要一定时间,为了确保清分的正确性,可以利用与交易批次相对应的交易时间条件进行限制,例如当前时间为8点25分,则仅允许清分8点05分之前的09批次的交易数据。After the transaction is officially completed, the transaction data will be in the final state of the transaction, and the transaction content will not be changed. It takes a certain amount of time from the generation of transaction data to the final transaction state. In order to ensure the correctness of the clearing, the transaction time conditions corresponding to the transaction batches can be used to limit. For example, if the current time is 8:25, then Only the transaction data of batch 09 before 8:05 is allowed to be cleared.

在本申请的一个实施例中,上述方法中,从交易数据库中查询出交易时间与交易时间条件匹配、处于交易终态且未完成清分的交易数据,作为待清分交易数据包括:根据交易数据的交易状态标识确定处于交易终态的交易数据,以及根据交易数据的清分标识确定未完成清分的交易数据。In an embodiment of the present application, in the above method, the transaction data whose transaction time matches the transaction time conditions, is in the final state of the transaction and has not been cleared is queried from the transaction database, and the transaction data to be cleared includes: according to the transaction The transaction status identifier of the data determines the transaction data in the final transaction state, and the transaction data that has not been cleared is determined according to the clearing identifier of the transaction data.

根据交易时间条件、清分标识和交易状态标识,可以生成相应的数据库操作语句以设置数据路由,由此可以确定哪些是需要清分的交易数据。According to transaction time conditions, clearing identifiers and transaction status identifiers, corresponding database operation statements can be generated to set data routing, thereby determining which transaction data needs to be cleared.

在本申请的一个实施例中,上述方法中,利用清分期内的多个清分执行期,对待清分交易数据分别进行清分包括:在清分执行期内,逐条对待清分交易数据进行清分,并累计本清分执行期内已清分的交易数据量;在累计的交易数据量达到第一阈值,或者所有待清分交易数据均已清分完毕的情况下,终止本清分执行期的清分。In an embodiment of the present application, in the above method, using a plurality of clearing execution periods in the clearing period, respectively clearing the transaction data to be cleared includes: in the clearing execution period, performing the clearing process one by one for the transaction data to be cleared. Clear and accumulate the transaction data volume that has been cleared during the execution period of this clearing; when the accumulated transaction data volume reaches the first threshold, or all the transaction data to be cleared have been cleared, the clearing will be terminated. Execution period clearing.

具体地,多个清分执行期可以共用一个统计本清分执行期内已清分的交易数据量的变量,在清分执行期的清分终止后,将变量的值归零,便于下一个清分执行期的统计。Specifically, multiple clearing execution periods can share a variable that counts the amount of transaction data cleared during the clearing execution period. Statistics of the clearing execution period.

在本申请的一个实施例中,上述方法还包括:在清分执行期内,成批次地确定已完成清分的交易数据的清分标识。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 have been cleared in batches.

在交易数据完成清分后,为了避免重复清分,需要对已完成清分的交易数据进行打标,也就是将其标记为已清分完成。在现有技术中,往往是边进行清分,边进行打标,这也是造成TPS过高的一个原因。因此本申请还进一步提出了将打标与清分独立开来,阶段性或者说成批次地对已完成清分的交易数据进行打标。例如,清分100条交易数据后,再对这100条交易数据进行打标,100条交易数据的清分和打标整体上作为一个数据库事务。经过验证,这种处理方式能够在确保清分效率的同时,降低数据库的TPS。After the transaction data is cleared, in order to avoid repeated clearing, it is necessary to mark the cleared transaction data, that is, mark it as cleared. In the prior art, marking is often performed while sorting, which is also one of the reasons for the high TPS. Therefore, the present application further proposes to separate the marking and the clearing, and to mark the cleared transaction data in stages or in batches. For example, after clearing 100 pieces of transaction data, the 100 pieces of transaction data are marked, and the sorting and marking of the 100 pieces of transaction data are regarded as a database transaction as a whole. It has been verified that this processing method can reduce the TPS of the database while ensuring the sorting efficiency.

在一些实施例中,交易数据库有多个,则需要将这些交易数据库的清分结果进行汇总,因此也可以在打标时进行相应清分结果的上报,从而将表级的清分结果依次汇总为库级、IDC级和交易批次级,等等。In some embodiments, if there are multiple transaction databases, the clearing results of these transaction databases need to be aggregated. Therefore, the corresponding clearing results can also be reported during marking, so that the table-level clearing results can be summarized in sequence For library level, IDC level and transaction batch level, etc.

具体实现上,在本申请的一个实施例中,上述方法中,成批次地确定已完成清分的交易数据的清分标识包括:累计已完成清分但未确定清分标识的交易数据量,在累计的交易数据量达到第二阈值的情况下,为已完成清分但未确定清分标识的交易数据批量确定清分标识,并在确定清分标识后,将累计的交易数据量清零。In terms of specific implementation, in an embodiment of the present application, in the above method, determining the clearing identifier of the transaction data that has been cleared in batches includes: accumulating the amount of transaction data for which clearing has been completed but the clearing identifier has not been determined. , when the accumulated transaction data volume reaches the second threshold, determine the clearing mark for the transaction data that has been cleared but the clearing mark has not yet been determined, and after the clearing mark is determined, clear the accumulated transaction data volume. zero.

在本申请的一个实施例中,上述方法中,各清分执行期的最大可执行时长相同,利用清分期内的多个清分执行期,对待清分交易数据分别进行清分包括:在清分执行期内,利用清分线程对待清分交易数据进行清分,并统计清分的总时长;若总时长小于最大可执行时长,则根据总时长和最大执行时长确定休眠时长,使清分线程根据休眠时长进行休眠。In an embodiment of the present application, in the above method, the maximum executable duration of each clearing execution period is the same, and using multiple clearing execution periods in the clearing period to clear the transaction data to be cleared separately includes: During the execution period, the clearing thread is used to clear the transaction data to be cleared, and the total time of clearing is counted; if the total time is less than the maximum executable time, the sleep time is determined according to the total time and the maximum execution time, so that the clearing The thread sleeps according to the sleep duration.

本申请的清分可以是利用清分线程来执行的,具体来说,一个交易数据库可以使用一个清分线程,该清分线程在一个清分期内的多个清分执行期分别对交易数据进行清分,为了兼顾鲁棒性和计算资源的利用,可以进行如下的设置,即清分第一阈值数量的交易数据所需的时间要小于清分执行期的最大可执行时长,例如清分执行期的最大可执行时长为1秒,而实际上清分5200条交易数据的时间一般不会超过500毫秒,这样就能确保即使数据库出现波动等情况下,也能够实现稳定的清分,但这样就可能造成计算资源的浪费,因此可以令清分线程进行休眠。休眠时长可以根据如上述的方法确定,在此不再赘述。The clearing of the present application may be performed by using a clearing thread. Specifically, a transaction database may use a clearing thread, and the clearing thread will perform a clearing process on transaction data in multiple clearing execution periods in one clearing period. Clearing, in order to take into account the robustness and the utilization of computing resources, the following settings can be made, that is, the time required to clear the transaction data of the first threshold amount is less than the maximum executable duration of the clearing execution period, for example, clearing execution The maximum executable duration of the transaction period is 1 second, but in fact, the time to clear 5,200 transaction data generally does not exceed 500 milliseconds, which can ensure stable clearing even if the database fluctuates. It may cause a waste of computing resources, so the clearing thread can be put to sleep. The sleep duration can be determined according to the above method, and details are not described herein again.

在本申请的一个实施例中,上述方法中,单个清分期内的多个清分执行期的总时长不大于第三阈值。In an embodiment of the present application, in the above method, the total duration of multiple clearing execution periods in a single clearing period is not greater than a third threshold.

例如,清分期为5分钟,而将清分期内多个清分执行期的总时长限制为4分钟,可以避免如下的情况产生:本次清分期应当在9点25分开始,9点30分结束,9点30开始下一个清分期,而由于某些故障导致本次清分期在9点25分30秒才开始,这样仍旧可以保证在下一个清分期开始前,本清分期仍能实现原定目标,具有很强的鲁棒性。第三阈值的设置可以根据实际需求确定。For example, if the clearing period is 5 minutes, and the total duration of multiple clearing execution periods in the clearing period is limited to 4 minutes, the following situations can be avoided: the clearing period should start at 9:25 and 9:30 End, the next clearing period starts at 9:30, and due to some faults, this clearing period does not start until 9:25:30, so that it can still be guaranteed that the current clearing period can still achieve the original plan before the next clearing period starts. target, with strong robustness. The setting of the third threshold can be determined according to actual requirements.

在本申请的一个实施例中,上述方法还包括:接收第一清分任务,第一清分任务对应于一个交易批次;第一清分任务的首次执行时间是根据交易批次的起始交易时间和第一延迟时间确定的;根据第一清分任务的首次执行时间开启该交易批次的首个清分期,并在每个清分期内分别执行第一清分任务,以实现利用多个清分期进行清分的步骤。In an embodiment of the present 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 based on the start of the transaction batch The transaction time and the first delay time are determined; according to the first execution time of the first clearing task, the first clearing period of the transaction batch is opened, and the first clearing task is executed in each clearing period, so as to realize the utilization of multiple The steps for clearing a clearing period.

具体来说,可以由清分服务器来生成并下发第一清分任务,数据库服务器负责执行。以8点至9点为一个交易批次的情况为例,若第一延迟时间为25分钟,每个清分期为5分钟,则在8点25分开启第一个清分期,8点30开启第二个清分期……换句话说,第一清分任务是一个定时任务,每5分钟执行一次。Specifically, the first sorting task can be generated and issued by the sorting server, and the database server is responsible for executing it. Taking 8:00 to 9:00 as a transaction batch as an example, if the first delay time is 25 minutes, and each clearing period is 5 minutes, the first clearing period will be opened at 8:25, and the first clearing period will be opened at 8:30. The second clearing period... In other words, the first clearing task is a timed task that is executed every 5 minutes.

在使用多个IDC部署交易数据库,每个IDC部署多个交易数据库等场景下,第一清分任务可以是对总清分任务进行一次或多次拆分得到的。例如可以由清分服务器的运维界面配置或触发总清分任务,清分服务器根据总清分任务确定清分所使用的交易数据库,进一步据此将总清分任务拆分为IDC级别的子清分任务,并下发至相应的IDC,在IDC进一步拆分为数据库级的第一清分任务。在执行时,可以参照前述实施例的方法,查询并获取数据表中的交易数据,进行后续的清分。In scenarios such as using multiple IDCs to deploy transaction databases and each IDC deploying multiple transaction databases, the first sorting task may be obtained by splitting the total sorting task one or more times. For example, the general clearing task can be configured or triggered by the operation and maintenance interface of the clearing server. The clearing server determines the transaction database used for clearing according to the general clearing task, and further divides the general clearing task into IDC-level sub-tasks accordingly. Sort tasks and send them to the corresponding IDC, where the IDC is further divided into the first sorting task at the database level. During execution, the method in the foregoing embodiment may be referred to to query and acquire the transaction data in the data table, and perform subsequent clearing.

在一些实施例中,第一清分任务在5分钟的清分期内是这样执行的:查询出要清分的交易数据,每个交易数据库利用一个清分线程,对查询出的交易数据进行逐条清分,每100条交易数据的清分视为一个数据库事务。In some embodiments, the first clearing task is performed in the clearing period of 5 minutes as follows: query the transaction data to be cleared, and each transaction database uses a clearing thread to perform one by one on the queried transaction data. Clearing, the clearing of every 100 transaction data is regarded as a database transaction.

1秒(清分执行期的最大可执行时长)内,累计清分的交易数据量,如果达到清分TPS(第一阈值),或者没有要清分的交易数据,则停止清分。如果没打标的交易数据达到第二阈值,则开始进行清分结果的上报和打标,依次类推,累计清分的交易数据量达到第一阈值的情况下,停止清分,可以把清分完但未打标的进行打标,之后统计执行时间,计算休眠时间,让清分线程进入休眠。Within 1 second (the maximum executable duration of the clearing execution period), the accumulated clearing transaction data volume will stop clearing if it reaches clearing TPS (the first threshold) or if there is no transaction data to clear. If the unmarked transaction data reaches the second threshold, the clearing result will be reported and marked, and so on. When the accumulated clearing transaction data reaches the first threshold, the clearing will be stopped, and the clearing can be Mark the finished but unmarked, then count the execution time, calculate the sleep time, and let the sorting thread go to sleep.

如果清分期内累计执行了4分钟,那么就停止清分,可以继续把已清分但是没打标的都打标,然后结束这个清分期内的工作。If a total of 4 minutes have been executed during the clearing period, then the clearing will be stopped, and you can continue to mark all those that have been cleared but not marked, and then end the work in the clearing period.

本申请的一个实施例中,上述方法还包括:接收第二清分任务,第二清分任务对应于交易批次,第二清分任务的执行时间是根据交易批次的起始交易时间和第二延迟时间确定的;根据第二清分任务的执行时间,执行第二清分任务,对交易批次的所有未完成清分的交易数据进行清分。In an embodiment of the present application, the above method further includes: receiving a second clearing task, the second clearing task corresponds to the transaction batch, and the execution time of the second clearing task is based on the initial transaction time of the transaction batch and the The second delay time is determined; according to the execution time of the second clearing task, the second clearing task is executed, and all the transaction data of the transaction batch that have not been cleared are cleared.

第二清分任务的目的主要是避免第一清分任务执行异常或者交易数据量过多,一般来说,第二清分任务需要清分的交易数据会很少,理想情况下也可能不会有需要清分的数据。The purpose of the second clearing task is to avoid abnormal execution of the first clearing task or excessive transaction data. Generally speaking, the transaction data that needs to be cleared in the second clearing task will be very small, and ideally it may not be There is data that needs to be sorted out.

图2示出的是现有技术中利用单一清分期集中清分的清分TPS示意图,图3示出的是根据本申请一个实施例的利用多个清分期进行清分的清分TPS示意图,深灰色块代表清分的交易数据量。可以看出,在8点25分至9点20分执行的是第一清分任务,9点20分至9点23分执行的是第二清分任务,第二清分任务所清分的交易数据量相比较起来非常少。Fig. 2 shows a schematic diagram of a clearing TPS in the prior art that utilizes a single clearing period for centralized clearing, and Fig. 3 shows a schematic diagram of a clearing TPS for clearing with multiple clearing periods according to an embodiment of the present application, The dark gray blocks represent the cleared transaction data volume. It can be seen that the first sorting task is executed from 8:25 to 9:20, the second sorting task is executed from 9:20 to 9:23, and the second sorting task The amount of transaction data is very small in comparison.

由于第二清分任务主要起的是一个兜底的处理,因此可以不设置一个阈值来进行TPS控制。Since the second sorting task is mainly to deal with the bottom line, it is not necessary to set a threshold for TPS control.

本申请还提供了一种交易数据的清分装置,用于实现如上任一所述的交易数据的清分方法。The present application also provides an apparatus for sorting transaction data, which is used to implement the method for sorting transaction data as described above.

具体地,图4示出了根据本申请一个实施例的交易数据的清分装置的结构示意图,交易数据的清分装置400可利用多个清分期对一个交易批次内的交易数据进行清分。如图4所示,交易数据的清分装置400包括:Specifically, FIG. 4 shows a schematic structural diagram of an apparatus for sorting transaction data according to an embodiment of the present application. The apparatus 400 for sorting transaction data can use multiple sorting periods to sort the transaction data in a transaction batch. . As shown in Figure 4, the transaction data sorting device 400 includes:

确定单元410,用于在各清分期中,确定交易数据库中与交易批次相对应的待清分交易数据。The determining unit 410 is configured to determine, in each clearing period, the transaction data to be cleared corresponding to the transaction batches in the transaction database.

清分执行单元420,用于在各清分期中,利用清分期内的多个清分执行期,对所述待清分交易数据分别进行清分,其中,每个清分执行期内清分的交易数据量不大于第一阈值。The clearing execution unit 420 is configured to, in each clearing period, use a plurality of clearing execution periods in the clearing period to clear the transaction data to be cleared respectively, wherein, in each clearing execution period, clearing The amount of transaction data is not greater than the first threshold.

在本申请的一个实施例中,上述装置中,清分执行单元420,用于根据预设的交易时间条件,从交易数据库中查询出交易时间与交易时间条件匹配、处于交易终态且未完成清分的交易数据,作为待清分交易数据。In an embodiment of the present application, in the above device, the clearing execution unit 420 is configured to query the transaction database from the transaction database to find out that the transaction time matches the transaction time condition, is in the final state of the transaction and has not been completed. The cleared transaction data is used as the transaction data to be cleared.

在本申请的一个实施例中,上述装置中,清分执行单元420,用于根据交易数据的交易状态标识确定处于交易终态的交易数据,以及根据交易数据的清分标识确定未完成清分的交易数据。In an embodiment of the present application, in the above-mentioned device, the clearing execution unit 420 is configured to determine the transaction data in the final state of the transaction according to the transaction status identifier of the transaction data, and determine that the clearing has not been completed according to the clearing identifier of the transaction data. transaction data.

在本申请的一个实施例中,上述方法中,利用多个清分执行期,对待清分交易数据分别进行清分包括:在清分执行期内,逐条对待清分交易数据进行清分,并累计本清分执行期内已清分的交易数据量;在累计的交易数据量达到第一阈值,或者所有待清分交易数据均已清分完毕的情况下,终止本清分执行期的清分。In an embodiment of the present application, in the above method, using multiple clearing execution periods to clear the transaction data to be cleared separately includes: during the clearing execution period, clearing the transaction data to be cleared one by one, and Accumulate the amount of transaction data that has been cleared during this clearing execution period; when the accumulated transaction data volume reaches the first threshold, or all the transaction data to be cleared have been cleared, the clearing of this clearing execution period will be terminated. point.

在本申请的一个实施例中,上述装置中,清分执行单元420,还用于在清分执行期内,成批次地确定已完成清分的交易数据的清分标识。In an embodiment of the present application, in the above device, the clearing execution unit 420 is further configured to determine, in batches, clearing identifiers of the transaction data that have been cleared during the clearing execution period.

在本申请的一个实施例中,上述装置中,清分执行单元420,用于累计已完成清分但未确定清分标识的交易数据量,在累计的交易数据量达到第二阈值的情况下,为已完成清分但未确定清分标识的交易数据批量确定清分标识,并在确定清分标识后,将累计的交易数据量清零。In an embodiment of the present application, in the above-mentioned device, the clearing execution unit 420 is configured to accumulate the transaction data volume for which clearing has been completed but the clearing identification has not been determined. When the accumulated transaction data volume reaches the second threshold , to determine the clearing mark in batches for the transaction data that has been cleared but the clearing mark has not been determined, and after the clearing mark is determined, the accumulated transaction data volume will be reset to zero.

在本申请的一个实施例中,上述装置中,各清分执行期的最大可执行时长相同,清分执行单元420,用于在清分执行期内,利用清分线程对待清分交易数据进行清分,并统计清分的总时长;若总时长小于最大可执行时长,则根据总时长和最大执行时长确定休眠时长,使清分线程根据休眠时长进行休眠。In an embodiment of the present application, in the above-mentioned device, the maximum executable duration of each clearing execution period is the same, and the clearing execution unit 420 is configured to use the clearing thread to perform the clearing process on the transaction data to be cleared during the clearing execution period. Clear and count the total duration of clearing; if the total duration is less than the maximum executable duration, the sleep duration is determined according to the total duration and the maximum execution duration, so that the clearing thread sleeps according to the sleep duration.

在本申请的一个实施例中,上述装置中,单个清分期内的多个清分执行期的总时长不大于第三阈值。In an embodiment of the present application, in the above device, the total duration of multiple clearing execution periods in a single clearing period is not greater than a third threshold.

在本申请的一个实施例中,上述装置中,确定单元410,用于接收第一清分任务,第一清分任务对应于一个交易批次;第一清分任务的首次执行时间是根据交易批次的起始交易时间和第一延迟时间确定的;根据第一清分任务的首次执行时间开启该交易批次的首个清分期,并在每个清分期内分别执行第一清分任务,以实现利用多个清分期进行清分的步骤。In an embodiment of the present application, in the above device, the determining unit 410 is configured to receive a first clearing task, the first clearing task corresponds to a transaction batch; the first execution time of the first clearing task is based on the transaction The initial transaction time of the batch and the first delay time are determined; the first clearing period of the transaction batch is opened according to the first execution time of the first clearing task, and the first clearing task is executed in each clearing period. , in order to realize the steps of clearing using multiple clearing periods.

本申请的一个实施例中,上述装置中,确定单元410,还用于接收第二清分任务,第二清分任务对应于交易批次,第二清分任务的执行时间是根据交易批次的起始交易时间和第二延迟时间确定的;清分执行单元420,还用于根据第二清分任务的执行时间,执行第二清分任务,对交易批次的所有未完成清分的交易数据进行清分。In an embodiment of the present application, in the above device, the determining unit 410 is further configured to receive a second clearing task, the second clearing task corresponds to a transaction batch, and the execution time of the second clearing task is based on the transaction batch The initial transaction time and the second delay time are determined; the clearing execution unit 420 is further configured to execute the second clearing task according to the execution time of the second clearing task. Transaction data is sorted.

能够理解,上述交易数据的清分装置,能够实现前述实施例中提供的由数据库服务器执行的交易数据的清分方法的各个步骤,关于交易数据的清分方法的相关阐释均适用于交易数据的清分装置,此处不再赘述。It can be understood that the above-mentioned device for sorting transaction data can implement each step of the method for sorting transaction data provided by the database server and executed by the database server, and the relevant explanations about the sorting method for transaction data are applicable to The sorting device is not repeated here.

图5是本申请的一个实施例数据库服务器的结构示意图。请参考图5,在硬件层面,该数据库服务器包括处理器,可选地还包括内部总线、网络接口、存储器。其中,存储器可能包含内存,例如高速随机存取存储器(Random-Access Memory,RAM),也可能还包括非易失性存储器(non-volatile memory),例如至少1个磁盘存储器等。当然,该数据库服务器还可能包括其他业务所需要的硬件。FIG. 5 is a schematic structural diagram of a database server according to an embodiment of the present application. Referring to FIG. 5 , at the hardware level, the database server includes a processor, and optionally an internal bus, a network interface, and a memory. The memory may include memory, such as high-speed random-access memory (Random-Access Memory, RAM), or may also include non-volatile memory (non-volatile memory), such as at least one disk memory. Of course, the database server may also include hardware required by other services.

处理器、网络接口和存储器可以通过内部总线相互连接,该内部总线可以是ISA(Industry Standard Architecture,工业标准体系结构)总线、PCI(PeripheralComponent Interconnect,外设部件互连标准)总线或EISA(Extended Industry StandardArchitecture,扩展工业标准结构)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图5中仅用一个双向箭头表示,但并不表示仅有一根总线或一种类型的总线。The processor, the network interface, and the memory can be connected to each other through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus, or an EISA (Extended Industry) bus. StandardArchitecture, extended industry standard structure) bus, etc. The bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one bidirectional arrow is shown in FIG. 5, but it does not mean that there is only one bus or one type of bus.

存储器,用于存放程序。具体地,程序可以包括程序代码,程序代码包括计算机操作指令。存储器可以包括内存和非易失性存储器,并向处理器提供指令和数据。memory for storing programs. Specifically, the program may include program code, and the program code includes computer operation instructions. The memory may include memory and non-volatile memory and provide instructions and data to the processor.

处理器从非易失性存储器中读取对应的计算机程序到内存中然后运行,在逻辑层面上形成交易数据的清分装置。处理器,执行存储器所存放的程序,并具体用于执行以下操作:The processor reads the corresponding computer program from the non-volatile memory into the memory and runs it, forming a sorting device for transaction data on a logical level. The processor executes the program stored in the memory, and is specifically used to perform the following operations:

利用多个清分期进行清分;Use multiple clearing periods for clearing;

在各清分期中,确定交易数据库中待清分交易数据,利用多个清分执行期,对待清分交易数据分别进行清分,其中,每个清分执行期内清分的交易数据量不大于第一阈值。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 separately, wherein the amount of transaction data cleared in each clearing execution period is not greater than the first threshold.

上述如本申请图1所示实施例揭示的交易数据的清分装置执行的方法可以应用于处理器中,或者由处理器实现。处理器可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital SignalProcessor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。The above-mentioned method executed by the apparatus for clearing transaction data disclosed in the embodiment shown in FIG. 1 of the present application may be applied to a processor, or implemented by a processor. A processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above-mentioned method can be completed by a hardware integrated logic circuit in a processor or an instruction 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 (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The methods, steps, and logic block diagrams disclosed in the embodiments of this application can be implemented or executed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied as executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other storage media mature in the art. The storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware.

该数据库服务器还可执行图1中交易数据的清分装置执行的方法,并实现交易数据的清分装置在图1所示实施例的功能,本申请实施例在此不再赘述。The database server can also execute the method executed by the transaction data sorting apparatus in FIG. 1 , and realize the functions of the transaction data sorting apparatus in the embodiment shown in FIG.

本申请实施例还提出了一种计算机可读存储介质,该计算机可读存储介质存储一个或多个程序,该一个或多个程序包括指令,该指令当被包括多个应用程序的数据库服务器执行时,能够使该数据库服务器执行图1所示实施例中交易数据的清分装置执行的方法,并具体用于执行:An embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, and the one or more programs include instructions, and the instructions are executed by a database server including multiple application programs. , the database server can be made to execute the method executed by the device for sorting transaction data in the embodiment shown in FIG. 1 , and is specifically used to execute:

利用多个清分期进行清分;Use multiple clearing periods for clearing;

在各清分期中,确定交易数据库中待清分交易数据,利用多个清分执行期,对待清分交易数据分别进行清分,其中,每个清分执行期内清分的交易数据量不大于第一阈值。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 separately, wherein the amount of transaction data cleared in each clearing execution period is not greater than the first threshold.

本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。As will be appreciated by those skilled in the art, the embodiments of the present application may be provided as a method, a system, or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.

本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It will be understood that each flow and/or block in the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device produce Means for implementing the functions specified in a flow or flow of a flowchart and/or a block or blocks of a block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions The apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that The instructions provide steps for implementing the functions specified in the flow or blocks of the flowcharts and/or the block or blocks of the block diagrams.

在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.

内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-persistent memory in computer readable media, random access memory (RAM) and/or non-volatile memory in the form of, for example, read only memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.

计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media includes both persistent and non-permanent, removable and non-removable media, and storage of information may be implemented by any method or technology. Information may be computer readable instructions, data structures, modules of programs, 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 Disc Read Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.

还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It should also be noted that the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device comprising a series of elements includes not only those elements, but also Other elements not expressly listed, or which are inherent to such a process, method, article of manufacture, or apparatus are also included. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in the process, method, article of manufacture, or device that includes the element.

本领域技术人员应明白,本申请的实施例可提供为方法、系统或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。It will be appreciated by those skilled in the art that the embodiments of the present application may be provided as a method, a system or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.

以上所述仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。The above descriptions are merely examples of the present application, and are not intended to limit the present application. Various modifications and variations of this application are possible for those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included within the scope of the claims of this application.

Claims (13)

1. A clearing method of transaction data is executed by a database server, wherein the method comprises clearing transaction data in a transaction batch by using a plurality of clearing periods;
wherein, in each of the cleaning stages,
determining to-be-cleared transaction data corresponding to the transaction batch in a transaction database;
and respectively counting the transaction data to be counted by utilizing a plurality of counting execution periods in the counting execution period, wherein the counting transaction data amount in each counting execution period is not more than a first threshold value.
2. The method of claim 1, wherein said determining outstanding transaction data in a transaction database corresponding to the transaction batch comprises:
and inquiring transaction data which is matched with the transaction time condition, is in a transaction final state and is not finished to be classified from the transaction database according to the transaction time condition corresponding to the transaction batch, and taking the transaction data as to-be-classified transaction data corresponding to the transaction batch.
3. The method as claimed in claim 2, wherein the querying transaction data of transaction time matched with the transaction time condition, in a transaction final state and incomplete clearing from the transaction database as the transaction data to be cleared comprises:
and determining the transaction data in the final transaction state according to the transaction state identification of the transaction data, and determining the transaction data of incomplete clearing according to the clearing identification of the transaction data.
4. The method of claim 1, wherein said separately accounting said transaction data to be accounted for utilizing a plurality of accounting execution periods within said accounting period comprises:
in the clearing execution period, clearing transaction data to be cleared one by one, and accumulating the cleared transaction data amount in the clearing execution period;
and terminating the clearing of the clearing execution period under the condition that the accumulated transaction data amount reaches a first threshold value or all transaction data to be cleared are cleared completely.
5. The method of claim 1, wherein the method further comprises:
and determining the counting identification of the transaction data which has finished counting in batches in the counting execution period.
6. The method of claim 5, wherein determining the tally identification of transaction data for which the tally has been completed in batches comprises:
and accumulating the transaction data volume which is subjected to clearing and is not determined with the clearing identification, determining the clearing identification for the transaction data which is subjected to clearing and is not determined with the clearing identification in batch under the condition that the accumulated transaction data volume reaches a second threshold value, and clearing the accumulated transaction data volume after the clearing identification is determined.
7. The method as claimed in claim 1, wherein the maximum executable duration of each of said liquidation executing periods is the same, and said separately liquidating said transaction data to be liquidated by using a plurality of liquidation executing periods within said liquidation period comprises:
in the clearing execution period, clearing the transaction data to be cleared by utilizing a clearing thread, and counting the total clearing time;
and if the total time length is less than the maximum executable time length, determining a sleep time length according to the total time length and the maximum executable time length, and enabling the sorting thread to sleep according to the sleep time length.
8. The method of claim 1, wherein a total duration of the plurality of clearing execution periods within a single clearing period is not greater than a third threshold.
9. The method of any one of claims 1-8, further comprising:
receiving a first clearing task, wherein the first clearing task corresponds to the transaction batch; the first execution time of the first clearing task is determined according to the initial trading time and the first delay time of the trading batch;
and starting the first clearing period of the transaction batch according to the first execution time of the first clearing task, and executing the first clearing task in each clearing period respectively so as to realize the step of clearing by utilizing a plurality of clearing periods.
10. The method of any one of claims 1-8, further comprising:
receiving a second clearing task, wherein the second clearing task corresponds to the transaction batch, and the execution time of the second clearing task is determined according to the initial transaction time and the second delay time of the transaction batch;
and executing the second clearing task according to the execution time of the second clearing task, and clearing all the unfinished clearing transaction data of the transaction batch.
11. A transaction data clearing device applied to a database server, wherein the device is used for implementing the method of any one of claims 1 to 10.
12. A database server, comprising:
a processor; and
a memory arranged to store computer executable instructions which, when executed, cause the processor to perform the method of any of claims 1 to 10.
13. A computer readable storage medium storing one or more programs which, when executed by a database server comprising a plurality of application programs, cause the database server to perform the method of any of claims 1-10.
CN202011214451.7A 2020-11-04 2020-11-04 Transaction data sorting method and device, database server and storage medium Active CN114445220B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011214451.7A CN114445220B (en) 2020-11-04 2020-11-04 Transaction data sorting method and device, database server and storage medium
PCT/CN2021/111006 WO2022095525A1 (en) 2020-11-04 2021-08-05 Method and apparatus for clearing transaction data, database server, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011214451.7A CN114445220B (en) 2020-11-04 2020-11-04 Transaction data sorting method and device, database server and storage medium

Publications (2)

Publication Number Publication Date
CN114445220A true CN114445220A (en) 2022-05-06
CN114445220B CN114445220B (en) 2025-07-18

Family

ID=81361486

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011214451.7A Active CN114445220B (en) 2020-11-04 2020-11-04 Transaction data sorting method and device, database server and storage medium

Country Status (2)

Country Link
CN (1) CN114445220B (en)
WO (1) WO2022095525A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115048369A (en) * 2022-06-29 2022-09-13 中信百信银行股份有限公司 Memory computing-based streaming data processing method and system
CN115617403A (en) * 2022-12-19 2023-01-17 深圳华锐分布式技术股份有限公司 Clearing task execution method, device, equipment and medium based on task segmentation
CN119539948B (en) * 2024-11-13 2025-09-30 天翼支付科技有限公司 Batch file processing method and device, storage medium and electronic device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160364797A1 (en) * 2015-06-10 2016-12-15 Chicago Mercantile Exchange Inc. Transaction Processing System Performance Evaluation
CN107025236A (en) * 2016-02-01 2017-08-08 阿里巴巴集团控股有限公司 Data processing method and data system for settling account between system for settling account
CN109726183A (en) * 2018-09-07 2019-05-07 网联清算有限公司 Net connection platform liquidation method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9898717B2 (en) * 2013-03-25 2018-02-20 Paypal, Inc. Online remittance system with methodology for predicting disbursement times of online electronic funds transfers
CN107203875B (en) * 2017-04-01 2021-07-20 网联清算有限公司 Capital clearing method, device and server
CN111105314A (en) * 2018-10-29 2020-05-05 中国人民财产保险股份有限公司 Insurance data clearing system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160364797A1 (en) * 2015-06-10 2016-12-15 Chicago Mercantile Exchange Inc. Transaction Processing System Performance Evaluation
CN107025236A (en) * 2016-02-01 2017-08-08 阿里巴巴集团控股有限公司 Data processing method and data system for settling account between system for settling account
CN109726183A (en) * 2018-09-07 2019-05-07 网联清算有限公司 Net connection platform liquidation method and device

Also Published As

Publication number Publication date
CN114445220B (en) 2025-07-18
WO2022095525A1 (en) 2022-05-12

Similar Documents

Publication Publication Date Title
WO2022095525A1 (en) Method and apparatus for clearing transaction data, database server, and storage medium
CN114116665B (en) Method for writing transaction log in parallel in database to promote processing efficiency
US20160350865A2 (en) Account processing method and apparatus
CN102356388B (en) Web front-end throttling
CN108574645B (en) A queue scheduling method and device
CN116089414B (en) Time series database writing performance optimization method and device based on massive data scenarios
CN110221914B (en) File processing method and device
WO2017016421A1 (en) Method of executing tasks in a cluster and device utilizing same
CN110704170A (en) Batch task processing method and device, computer equipment and storage medium
CN110287038A (en) Promote the method and system of the data-handling efficiency of Spark Streaming frame
CN117093653B (en) Informationized resource sharing method and system
CN115665045A (en) A high concurrency current limiting method, device and computer storage medium
CN115048466A (en) Data analysis method, system, terminal and storage medium
CN115686789B (en) Discrete event parallel processing method, terminal equipment and storage medium
CN110222016B (en) File processing method and device
WO2019174185A1 (en) Electronic device, dynamic code request processing method and storage medium
CN114546714B (en) A data backup method, system, device and storage medium
CN114706836A (en) A Data Lifecycle Management Method Based on Airborne Embedded Database
CN114429346A (en) Transaction flow data processing method and device and data processing system server
CN118152097A (en) Data reporting method, system, device, computer equipment and storage medium
CN111459474A (en) Templated data processing method and device
WO2020224218A1 (en) Hbase-based data writing method, system, device, and readable storage medium
CN112148782B (en) Market data access method and device
CN111314440B (en) Method and system for loop detection on graph-structured data
CN115202979A (en) A kind of SQL real-time monitoring method, system, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载