Distributed data processing method and device, computer device and storage medium

By grouping accounting requests and determining target data shards, the problem of excessive accounting transactions in distributed data processing systems is solved, thereby improving processing speed and performance.

CN116467390BActive Publication Date: 2026-01-02CLP JINXIN SOFTWARE (SHANGHAI CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310458946.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-25
Publication Date
2026-01-02
Estimated Expiration
2043-04-25

AI Technical Summary

Technical Problem

In a distributed, modular, multi-site, active-active data processing system, when accounting requests involve different data shards, the number of accounting transactions is high, resulting in poor processing speed and performance.

Method used

By grouping accounting requests, determining the target data shard based on the data shard identifier, and executing accounting instructions on the same server, the number of calls to the target data shard and the number of accounting operations are reduced.

Benefits of technology

It improves the processing speed and performance of accounting requests, and reduces the number of calls to target data shards and accounting operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116467390B_ABST
    Figure CN116467390B_ABST
Patent Text Reader

Abstract

The application provides a distributed data processing method and device, computer equipment and a storage medium, and relates to the technical field of data processing. The method comprises the following steps: receiving a plurality of accounting requests, each accounting request comprising an accounting parameter and a data shard identifier; grouping the plurality of accounting requests according to the data shard identifiers to obtain an accounting request group, the data shard identifiers of each accounting request group being the same; determining a target data shard of the accounting request group in a server corresponding to the data shard identifier according to the data shard identifier in each accounting request group and the identifier of the data shard on each server; and executing an accounting instruction in the corresponding target data shard for each accounting request group, the accounting instruction being used to instruct the target data shard to execute a corresponding accounting operation according to the accounting parameter of the accounting request in each accounting request group. The application can reduce the number of times that the data shard executes an accounting transaction, and improve the speed and performance of processing the accounting request.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, in particular to a distributed data processing method and device, computer equipment and storage medium. BACKGROUND

[0002] With the gradual increase of the business volume of financial enterprises, in order to ensure the quality of service, the financial enterprises have gradually developed a distributed unit multi-site multi-active data processing system.

[0003] The distributed unit multi-site multi-active data processing system involves application service nodes and data servers distributed in different regions, and the data servers are also composed of multiple data shards.

[0004] In order to improve the accounting efficiency, each application service node will receive multiple accounting requests each time, and when the multiple accounting requests involve different data shards, multiple accounting transactions may be executed for each data shard, resulting in poor speed and performance of processing the accounting requests. SUMMARY

[0005] The present application aims at the deficiencies in the prior art, and provides a distributed data processing method, device, computer equipment and storage medium, so as to reduce the number of accounting transactions executed by data shards and improve the speed and performance of processing accounting requests.

[0006] To achieve the above object, the technical scheme adopted by the embodiments of the present application is as follows:

[0007] In a first aspect, the embodiments of the present application provide a distributed data processing method applied to a local service node, which comprises:

[0008] receiving multiple accounting requests, each accounting request including an accounting parameter and a data shard identifier;

[0009] grouping the multiple accounting requests according to the data shard identifiers to obtain at least one accounting request group, so that the data shard identifiers in each accounting request group are the same;

[0010] determining the target data shard corresponding to each accounting request group in the server corresponding to the data shard identifier according to the data shard identifier in each accounting request group and the identifier of the data shard on each server;

[0011] For the accounting request group of which the target data shard belongs to the same server, a corresponding server is invoked, and in the corresponding server, an accounting instruction is executed in the corresponding target data shard for each accounting request group, the accounting instruction being used to instruct the target data shard to perform a corresponding accounting operation according to the accounting parameters of the accounting request in each accounting request group.

[0012] Optionally, if the at least one accounting request group is one accounting request group of which the data shard identification belongs to the same target data shard in the local server, the invoking of the corresponding server and the execution of the accounting instruction in the corresponding server for each accounting request group in the corresponding target data shard comprises:

[0013] invoking the local server to execute one local accounting instruction in the corresponding target data shard of the local server for the one accounting request group.

[0014] Optionally, if the at least one accounting request group is a plurality of accounting request groups of which the data shard identification belongs to a plurality of target data shards in the local server, the invoking of the corresponding server and the execution of the accounting instruction in the corresponding server for each accounting request group in the corresponding target data shard comprises:

[0015] invoking the local server to execute a plurality of local accounting instructions in a plurality of target data shards corresponding to the local server for the plurality of accounting request groups, the local accounting instruction being used to instruct the target data shard to perform a first stage operation of the accounting operation according to the accounting parameters of the accounting request in the corresponding accounting request group;

[0016] receiving operation results of the first stage operation of the plurality of target data shards;

[0017] executing a plurality of second stage operation execution instructions in the plurality of target data shards respectively according to the operation results of the first stage operation, the second stage operation execution instruction being used to instruct the target data shard to perform a second stage operation on the accounting request in the accounting request group.

[0018] Optionally, if the corresponding server of at least one first accounting request group in the at least one accounting request group is the local server and the corresponding server of at least one second accounting request group is the remote server, the invoking of the corresponding server and the execution of the accounting instruction in the corresponding server for each accounting request group in the corresponding target data shard comprises:

[0019] invoke the local server, execute at least one local accounting instruction in the at least one target data shard corresponding to the local server for the at least one first accounting request group, the local accounting instruction being used to instruct the target data shard corresponding to the local server to perform the first stage operation of the accounting operation according to the accounting parameter of the accounting request in the corresponding accounting request group;

[0020] invoke the remote server, execute at least one remote accounting instruction in the at least one target data shard corresponding to the remote server for the at least one second accounting request group, the remote accounting instruction being used to instruct the target data shard corresponding to the remote server to perform the first stage operation of the accounting operation according to the accounting parameter of the accounting request in the corresponding accounting request group;

[0021] receive the operation result of the first stage operation of the plurality of target data shards;

[0022] according to the operation result of the first stage operation, execute a plurality of second stage operation execution instructions in the plurality of target data shards of the local server and the remote server respectively, the second stage operation execution instruction being used to instruct the target data shard to perform the second stage operation on the accounting request in the accounting request group.

[0023] Optionally, the accounting parameter comprises an accounting account and to-be-accounted data, if the operation result of the first stage operation is that the resource data of the accounting account in all target data shards satisfies the to-be-accounted data, the second stage operation execution instruction is used to instruct the target data shard to modify the resource data of the accounting account according to the resource data of the accounting account and the to-be-accounted data;

[0024] if the operation result of the first stage operation is that there is a target data shard in which the resource data of the accounting account does not satisfy the to-be-accounted data, the second stage operation execution instruction is used to instruct the target data shard not to modify the resource data of the accounting account.

[0025] Optionally, before the receiving the operation result of the first stage operation of the plurality of target data shards, the method further comprises:

[0026] if the target data shard of the local server or the target data shard of the remote server interrupts the execution of the first stage operation, or the execution time of the execution of the first stage operation is greater than a preset time, a rollback instruction is sent to the local server and the remote server respectively, the rollback instruction being used to instruct the target data shard of the local server and the target data shard of the remote server to cancel the operation data of the accounting request group that has been executed.

[0027] Optionally, the method further comprises:

[0028] If it is detected that the execution time of any target data shard performing the second stage operation is greater than the preset time, an operation re-execution instruction is sent to the any target data shard, so that the any target data shard re-executes the second stage operation.

[0029] In a second aspect, the embodiments of the present application also provide a distributed data processing apparatus applied to a local service node, the apparatus comprising:

[0030] a billing request receiving module configured to receive a plurality of billing requests, each of which comprises a billing parameter and a data shard identifier;

[0031] a billing request grouping module configured to group the plurality of billing requests according to the data shard identifiers, so as to obtain at least one billing request group, so that the data shard identifiers in each billing request group are the same;

[0032] a data shard determining module configured to determine, according to the data shard identifiers in each billing request group and the identifiers of data shards on each server, a target data shard corresponding to each billing request group in a server corresponding to the data shard identifier;

[0033] a billing instruction executing module configured to, for a billing request group in which the target data shards belong to the same server, call a corresponding server, and execute, in the corresponding server, a billing instruction for each billing request group in a corresponding target data shard, the billing instruction being used to instruct the target data shard to perform a corresponding billing operation according to the billing parameters of the billing requests in each billing request group.

[0034] Optionally, if the at least one billing request group is one billing request group in which the data shard identifiers belong to the same target data shard in a local server, the billing instruction executing module is specifically configured to call the local server, and execute one local billing instruction for the one billing request group in a corresponding target data shard of the local server.

[0035] Optionally, if the at least one billing request group is a plurality of billing request groups in which the data shard identifiers belong to a plurality of target data shards in a local server, the billing instruction executing module comprises:

[0036] a local billing instruction executing unit configured to call the local server, and execute a plurality of local billing instructions for the plurality of billing request groups in a plurality of target data shards corresponding to the local server, the local billing instruction being used to instruct the target data shard to perform a first stage operation of the billing operation according to the billing parameters of the billing requests in the corresponding billing request group;

[0037] an operation result receiving unit, configured to receive operation results of the first stage operations of the plurality of target data shards;

[0038] a second stage operation executing unit, configured to execute a plurality of second stage operation executing instructions in the plurality of target data shards respectively according to the operation results of the first stage operations, the second stage operation executing instructions being used to instruct the target data shards to perform second stage operations on the accounting requests in the accounting request groups.

[0039] Optionally, if the server corresponding to the at least one first accounting request group is a local server and the server corresponding to the at least one second accounting request group is a remote server, the accounting instruction executing module further comprises a remote accounting instruction executing unit.

[0040] The local accounting instruction executing unit is further configured to invoke the local server to execute at least one local accounting instruction in at least one target data shard corresponding to the local server for the at least one first accounting request group, the local accounting instruction being used to instruct the target data shard corresponding to the local server to perform the first stage operation of the accounting operation according to the accounting parameters of the accounting requests in the corresponding accounting request group.

[0041] The remote accounting instruction executing unit is configured to invoke the remote server to execute at least one remote accounting instruction in at least one target data shard corresponding to the remote server for the at least one second accounting request group, the remote accounting instruction being used to instruct the target data shard corresponding to the remote server to perform the first stage operation of the accounting operation according to the accounting parameters of the accounting requests in the corresponding accounting request group.

[0042] The operation result receiving unit is configured to receive operation results of the first stage operations of the plurality of target data shards.

[0043] The second stage operation executing unit is further configured to execute a plurality of second stage operation executing instructions in the plurality of target data shards of the local server and the remote server respectively according to the operation results of the first stage operations, the second stage operation executing instructions being used to instruct the target data shards to perform second stage operations on the accounting requests in the accounting request groups.

[0044] Optionally, the accounting parameters comprise an accounting account and to-be-accounted data, and if the operation result of the first stage operation is that resource data of the accounting account in all target data shards satisfies the to-be-accounted data, the second stage operation executing instruction is used to instruct the target data shard to modify the resource data of the accounting account according to the resource data of the accounting account and the to-be-accounted data.

[0045] If the operation result of the first stage operation is that the resource data of the accounting account in one target data shard does not meet the to-be-accounted data, the second stage operation execution instruction is used to instruct the target data shard not to modify the resource data of the accounting account.

[0046] Optionally, before the operation result receiving unit, the apparatus further comprises:

[0047] A rollback module is configured to send a rollback instruction to the local server and the remote server respectively if the target data shard of the local server or the target data shard of the remote server interrupts the first stage operation or the execution time of the first stage operation is greater than a preset time, and the rollback instruction is used to instruct the target data shard of the local server and the target data shard of the remote server to cancel the operation data of the accounting request group.

[0048] Optionally, the apparatus further comprises:

[0049] A re-execution module is configured to send an operation re-execution instruction to any target data shard if it is detected that the execution time of the second stage operation of the target data shard is greater than a preset time, so that the target data shard re-executes the second stage operation.

[0050] In a third aspect, an embodiment of the present application further provides a computer device, comprising a processor, a storage medium and a bus, the storage medium stores program instructions executable by the processor, when the computer device is running, the processor and the storage medium communicate through the bus, and the processor executes the program instructions to perform the steps of the distributed data processing method according to any one of the first aspect.

[0051] In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium, the storage medium stores a computer program, and the computer program is run by a processor to perform the steps of the distributed data processing method according to any one of the first aspect.

[0052] The present application has the following beneficial effects:

[0053] The distributed data processing method, device, computer device and storage medium provided by the present application group the accounting requests according to the data shard identifiers, and determine the target data shards corresponding to each accounting request group. For the accounting request groups whose target data shards belong to the same server, the corresponding server is called, and the accounting instructions of each accounting request group are executed by each target data shard in the corresponding server. Compared with sending each accounting request to the data shard for accounting separately, the number of times of calling the server where the target data shard is located and the number of times of executing the accounting operation by the target data shard are reduced, and the speed and performance of processing the accounting request are improved. BRIEF DESCRIPTION OF DRAWINGS

[0054] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation to the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0055] Figure 1 The architecture diagram of the distributed data processing system provided by the embodiments of the present application;

[0056] Figure 2 The flowchart of the distributed data processing method provided by the embodiments of the present application Figure 1 ;

[0057] Figure 3 The flowchart of the distributed data processing method provided by the embodiments of the present application Figure 2 ;

[0058] Figure 4 The flowchart of the distributed data processing method provided by the embodiments of the present application Figure 3 ;

[0059] Figure 5 The flowchart of the first stage operation provided by the embodiments of the present application;

[0060] Figure 6 The structure diagram of the distributed data processing device provided by the embodiments of the present application;

[0061] Figure 7 The schematic diagram of the computer device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0062] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some but not all of the embodiments of the present application.

[0063] Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work are within the scope of protection of the present application.

[0064] In addition, the terms "first", "second", and the like in the description, claims, and drawings of the present application are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.

[0065] It should be noted that the features in the embodiments of the present application can be combined with each other without conflict.

[0066] In order to facilitate the understanding of the scheme of the embodiments of the present application, the architecture of the distributed data processing system involved in the embodiments of the present application will be described first.

[0067] Please refer to Figure 1 The architecture diagram of the distributed data processing system provided by the embodiments of the present application is shown in Figure 1 The distributed data processing system includes a plurality of application service nodes and servers managed by each application service node. The servers managed by each application service node are local servers of the application service node, and other data servers are remote servers. The local server can be a server in the same region or the same local area network as the application service node, and the remote server can be a server in a different region or a different local area network from the application service node. It should be noted that the concepts of local server and remote server are both relative to the application service node. The local server of an application service node is also a remote server of other application service nodes.

[0068] Each application service node has a general accounting interface for receiving accounting requests sent by a business system, the application service node receiving the accounting request is a management node, and the accounting instruction is executed by calling a local server and / or an off-site server, wherein the off-site server needs to be called through RPC (Remote Procedure Call Protocol).

[0069] The servers managed by the plurality of application service nodes constitute a distributed server, the smallest unit of the server is a data shard, each data shard corresponds to a sub-server, a plurality of data shards constitute a server, and a plurality of servers distributed in different locations or different regions jointly constitute a distributed server. For example, if there are 100 data shards, the 100 data shards are divided into multiple parts, and each part of the data shards corresponds to a plurality of sub-servers to constitute a server.

[0070] When a user opens an account in a financial enterprise, the user is allocated a customer number and an accounting account number, wherein the customer number can be generated according to the identity information of the user, each customer has a unique customer number in the financial enterprise, and a plurality of accounting account numbers can be included under each customer number, and according to the customer number, all accounting account numbers of each user are allocated under a data shard, and when the accounting account number of the user generates an accounting request, the data shard identifier of the accounting account number is carried in the accounting request to instruct the application service node to perform an accounting operation in the corresponding data shard.

[0071] Based on the above distributed data processing system, the embodiment of the present application provides a distributed data processing method applied to any application service node.

[0072] Please refer to Figure 2 The flowchart of the distributed data processing method provided by the embodiment of the present application is shown in Figure 1 As Figure 2 shown, the method can include:

[0073] S10: receiving a plurality of accounting requests, each accounting request including an accounting parameter and a data shard identifier.

[0074] In this embodiment, the business system receives a transaction instruction sent by a user, generates an accounting request according to the transaction instruction, and sends a plurality of accounting requests to the application service node through the general accounting interface of the application service node. The data shard identifier is determined according to the data shard to which the accounting account number corresponding to the transaction instruction belongs.

[0075] In some embodiments, the plurality of accounting requests are sent to the application service node in an array structure, and each row of data in the array corresponds to an accounting request.

[0076] S20: Group the plurality of accounting requests according to the data shard identifiers, to obtain at least one accounting request group, so that the data shard identifiers in each accounting request group are the same.

[0077] In order to execute the accounting instruction only once for the same data shard, so that all accounting requests in the accounting request group complete the accounting, in this embodiment, the plurality of accounting requests are grouped according to the data shard identifiers of the plurality of accounting requests, the accounting requests with the same data shard identifier are grouped into one group, to obtain at least one accounting request group, and each accounting request group includes at least one accounting request.

[0078] S30: Determine the target data shard corresponding to each accounting request group in the server corresponding to the data shard identifier according to the data shard identifier in each accounting request group and the identifier of the data shard on each server.

[0079] In this embodiment, according to the identifier of the data shard contained in each server, the data shard corresponding to the data shard identifier in the accounting request group in the data shard of the server is determined as the target data shard. For example, server A has data shard 1 and data shard 2, the data shard identifier in the accounting request is 1, corresponding to data shard 1 in server A, and the data shard identifier in the accounting request is 2, corresponding to data shard 2 in server A.

[0080] S40: For the accounting request groups in which the target data shards belong to the same server, call the corresponding server, and in the corresponding server, execute the accounting instruction in the corresponding target data shard for each accounting request group. The accounting instruction is used to instruct the target data shard to execute the corresponding accounting operation according to the accounting parameters of the accounting request in each accounting request group.

[0081] In this embodiment, one accounting instruction is generated for each accounting request group, and the accounting request in each accounting request group is included in the accounting instruction. For the accounting request groups in which the target data shards belong to the same server, the corresponding server is called once, and the accounting instruction of the accounting request group of the target data shard belonging to the same server is sent to the same server. The server executes the accounting instruction in each target data shard corresponding to each accounting request group, so that each target data shard executes the accounting operation according to the accounting parameters of the accounting request in each accounting request group.

[0082] In some embodiments, after the accounting operation is successfully executed, the target data shard generates an accounting voucher or an accounting detail record, and the target data shard can return the accounting voucher or the accounting detail record to the application service node.

[0083] In a possible implementation, the application service node establishes one accounting transaction for each accounting request group, each accounting transaction being one accounting instruction, the accounting transaction including the accounting requests of each accounting request group, each accounting transaction being stored in a process pool of the application service node as a to-be-processed process, the application service node sequentially obtains each accounting transaction from the process pool, sends the accounting transactions belonging to the same server to the corresponding server, and sends each accounting transaction to the target data shard corresponding to each accounting request group by the server, so that the target data shard executes the accounting transaction and performs the accounting operation according to the accounting parameters of the accounting requests in each accounting request group.

[0084] The above possible implementations of forwarding the accounting request group to the server are described below in combination with multiple embodiments.

[0085] In the first possible implementation, if at least one accounting request group is an accounting request group whose data shard identifier belongs to the same target data shard in the local server, the S40 includes:

[0086] The local server is invoked to execute one local accounting instruction in the target data shard corresponding to the accounting request group in the local server.

[0087] In this embodiment, the multiple accounting requests are grouped according to the data shard identifiers of the multiple accounting requests, if the data shard identifiers of the multiple accounting requests are the same and the server corresponding to the data shard identifier is the local server, the multiple accounting requests are grouped into one accounting request group, the server corresponding to the accounting request group is the local server, and the target data shard corresponding to the data shard identifier is one data shard in the local server.

[0088] One accounting instruction is generated for the accounting request group, the accounting instruction including the accounting requests in the accounting request group, the local server is invoked, the accounting instruction is sent to the local server, and the local server executes one accounting instruction in the target data shard corresponding to the accounting request group, so that the target data shard performs the accounting operation according to the accounting parameters of the accounting requests in the accounting request group.

[0089] For example, the application service node creates one local accounting transaction for the accounting request group, the local accounting transaction including the accounting request group, the local server is invoked, the local accounting transaction is sent to the local server, and the target data shard on the local server executes the local accounting transaction to sequentially perform the accounting operation for the accounting requests in the accounting request group.

[0090] In the second possible implementation, please refer to Figure 3 The flowchart of the distributed data processing method provided by the embodiment of the application Figure 2 For example,Figure 3 The S40 can include the following steps.

[0091] S41: calling the local server, executing a plurality of local accounting instructions in a plurality of target data shards corresponding to the local server for a plurality of accounting request groups, the local accounting instruction being used to instruct the target data shard to perform a first stage operation of the accounting operation according to the accounting parameters of the accounting request in the corresponding accounting request group.

[0092] In this embodiment, the plurality of accounting requests are grouped according to the data shard identifiers of the plurality of accounting requests to obtain a plurality of accounting request groups, and if the servers corresponding to the data shard identifiers of the plurality of accounting requests are all local servers, the data shard identifiers of the plurality of accounting request groups correspond to a plurality of target data shards in the local server.

[0093] A plurality of local accounting instructions are generated for the plurality of accounting request groups, each accounting instruction including a corresponding accounting request group, the local server is called, and the plurality of local accounting instructions are sent to the local server, so that the local server executes the corresponding local accounting instruction in the target data shard corresponding to each accounting request group, so that each target data shard performs a first stage operation of the accounting operation according to the accounting parameters of the accounting request in each accounting request group. The first stage operation is a pre-accounting stage.

[0094] In an example, the application service node creates a plurality of local accounting transactions for the plurality of accounting request groups, each local accounting transaction including a corresponding accounting request group, and sends the plurality of local accounting transactions to a plurality of target data shards on the local server, so that the plurality of target data shards on the local server execute the corresponding local accounting transactions respectively, and sequentially execute the first stage operation on the accounting request in the accounting request group.

[0095] S42: receiving the operation results of the first stage operation of the plurality of target data shards.

[0096] In this embodiment, the operation result of the first stage operation of each target data shard is used to indicate whether each target data shard successfully executes all accounting requests in the corresponding accounting request group, if each target data shard successfully executes all accounting requests in the corresponding accounting request group, the operation result of the first stage operation is successful, and if each target data shard fails to execute one accounting request in the corresponding accounting request group, the operation result of the first stage operation is failed.

[0097] S43: according to the operation result of the first stage operation, respectively executing a plurality of second stage operation execution instructions in the plurality of target data shards, the second stage operation execution instruction being used to instruct the target data shard to perform a second stage operation on the accounting request in the accounting request group.

[0098] In this embodiment, the second stage operation is a confirmation billing stage or a cancellation billing stage. If the operation result of the first stage operation of all target data shards is success, the second stage operation is a confirmation billing. If the operation result of the first stage operation of one target data shard is failure, the second stage operation is a cancellation billing.

[0099] In a third possible implementation, referring to Figure 4 , the flow of the distributed data processing method provided by the embodiment of the present application is shown Figure 3 , as shown in Figure 4 , the above S40 can include:

[0100] S44: calling the local server, and executing at least one local billing instruction in at least one target data shard corresponding to the local server for at least one first billing request group. The local billing instruction is used to instruct the target data shard corresponding to the local server to execute the first stage operation of the billing operation according to the billing parameter of the billing request in the corresponding billing request group.

[0101] S45: calling the remote server, and executing at least one remote billing instruction in at least one target data shard corresponding to the remote server for at least one second billing request group. The remote billing instruction is used to instruct the target data shard corresponding to the remote server to execute the first stage operation of the billing operation according to the billing parameter of the billing request in the corresponding billing request group.

[0102] S46: receiving the operation result of the first stage operation of the plurality of target data shards.

[0103] S47: according to the operation result of the first stage operation, respectively executing a plurality of second stage operation execution instructions in the plurality of target data shards of the local server and the remote server. The second stage operation execution instruction is used to instruct the target data shard to execute the second stage operation on the billing request in the billing request group.

[0104] In this embodiment, the plurality of accounting requests are grouped according to the data shard identifiers of the plurality of accounting requests, to obtain a plurality of accounting request groups, wherein the data shard identifiers of at least one first accounting request group in the plurality of accounting request groups correspond to a local server, the data shard identifiers of at least one second accounting request group in the plurality of accounting request groups correspond to a remote server, if the at least one first accounting request group is one first accounting request group, the first accounting request group corresponds to one target data shard in the local server, if the at least one first accounting request group is a plurality of first accounting request groups, the plurality of first accounting request groups correspond to a plurality of target data shards in the local server; similarly, the data shard identifiers of the at least one second accounting request group can correspond to one target data shard in one remote server, can correspond to a plurality of target data shards in one remote server, or can correspond to a plurality of target data shards in a plurality of remote servers.

[0105] At least one local accounting instruction is generated for the at least one first accounting request group belonging to the local server, the local server is called, and the at least one local accounting instruction is sent to the local server, so that the local server executes the corresponding local accounting instruction in each target data shard corresponding to each first accounting request group, so that each target data shard executes the first stage operation of the accounting operation according to the accounting parameters of the accounting request in each first accounting request group.

[0106] At least one remote accounting instruction is generated for the at least one second accounting request group belonging to the remote server, the remote server is called, and the at least one remote accounting instruction is sent to the remote server, so that the remote server executes the corresponding remote accounting instruction in each target data shard corresponding to each second accounting request group, so that each target data shard executes the first stage operation of the accounting operation according to the accounting parameters of the accounting request in each second accounting request group. The remote accounting instruction needs to be sent to the remote server through RPC call.

[0107] For example, the application service node creates a plurality of local accounting transactions and remote accounting transactions for the plurality of accounting request groups, sends the plurality of local accounting transactions to the local server, and executes the corresponding local accounting transactions on the target data shards on the local server to sequentially execute the first stage operation on the accounting requests in the accounting request group; the plurality of remote accounting transactions are sent to the remote server, and the corresponding remote accounting transactions are executed on the target data shards on the remote server to sequentially execute the first stage operation on the accounting requests in the accounting request group.

[0108] According to the operation results of the first-stage operations of the plurality of target data shards of the local server and the off-site server, a plurality of second-stage operation execution instructions are executed in the plurality of target data shards of the local server and the off-site server respectively, if the operation results of the first-stage operations of all target data shards are successful, the second-stage operation is a confirm accounting, if the operation result of the first-stage operation of one target data shard is a failure, the second-stage operation is a cancel accounting.

[0109] In a possible implementation, the accounting parameter includes an accounting account and to-be-accounted data, if the operation result of the first-stage operation is that the resource data of the accounting account in all target data shards meets the to-be-accounted data, the second-stage operation execution instruction is used to instruct the target data shard to modify the resource data of the accounting account according to the resource data of the accounting account and the to-be-accounted data; if the operation result of the first-stage operation is that there is one target data shard in which the resource data of the accounting account does not meet the to-be-accounted data, the second-stage operation execution instruction is used to instruct the target data shard not to modify the resource data of the accounting account.

[0110] In this embodiment, the first-stage operation is used to obtain the resource data of all accounting accounts stored in the target data shard according to the accounting account in all accounting requests in each accounting request group, and to determine whether each accounting account can successfully reserve the resource data corresponding to the to-be-accounted data according to the resource data of each accounting account and the to-be-accounted data, if yes, the resource data corresponding to the to-be-accounted data is reserved from the resource data of each accounting account, so as to be confirmed by the second-stage operation. It should be noted that, only for the case that the to-be-accounted data is the spending data, it is determined whether each accounting account can successfully reserve the resource data corresponding to the to-be-accounted data, and the reserved data is used as the pre-frozen data; if the to-be-accounted data is the income data, it is not necessary to determine whether each accounting account can successfully reserve the resource data corresponding to the to-be-accounted data, and the un-reached account data is directly generated according to the to-be-accounted data.

[0111] If the resource data of all accounting accounts in the accounting request group meets the to-be-accounted data, it is determined that the resource data corresponding to the to-be-accounted data can be successfully reserved, and the operation result of the first-stage operation is successful, if there is one accounting account in the accounting request group whose resource data does not meet the to-be-accounted data, it is determined that the resource data corresponding to the to-be-accounted data is not successfully reserved, and the operation result of the first-stage operation is a failure.

[0112] If the operation result of the first stage operation of all target data shards is success, the second stage operation is used to modify the resource data of the accounting account according to the resource data of the accounting account and the to-be-accounted data, wherein if the to-be-accounted data is the expenditure data, the modified resource data is the initial resource data minus the to-be-accounted data; if the to-be-accounted data is the income data, the modified resource data is the initial resource data plus the to-be-accounted data. If the operation result of the first stage operation of one target data shard is failure, the second stage operation is used to cancel the reserved resource data corresponding to the to-be-accounted data, and no modification is made to the resource data of the accounting account.

[0113] The distributed data processing method provided by the above embodiment groups the accounting requests according to the data shard identifiers, determines the target data shards corresponding to each accounting request group, and executes the accounting instructions of each accounting request group by the target data shards, which, compared with separately sending each accounting request to the data shards for accounting, reduces the number of times of calling the servers where the target data shards are located and the number of times of executing the accounting operations by the target data shards, and improves the speed and performance of processing the accounting requests.

[0114] In some embodiments, the application service node pre-creates a management transaction table, records the master transaction identifiers of the plurality of accounting requests in the management transaction table, and determines the master transaction state of the plurality of accounting requests as an initial state; the application service node sends the accounting instructions of each accounting request group to the corresponding servers, and when the target data shards of the servers execute the accounting instructions, the target data shards register the accounting request groups in the branch transaction table in the accounting instructions, and determine the branch transaction state of the accounting request groups as an initial state.

[0115] If the operation result of the first stage operation of the target data shard is success, the branch transaction state of the accounting request group is updated as to-be-committed, and if the operation result of the first stage operation of the target data shard is failure, the branch transaction state of the accounting request group is updated as to-be-rolled back.

[0116] After the application service node successfully receives the operation result of the first stage operation of each target data shard, it is determined that the execution of the accounting transaction by each target data shard is success, the master transaction state in the management transaction table is updated as to-be-committed, and if the operation result of the first stage operation of any target data shard is failure, the master transaction state in the management transaction table is updated as to-be-rolled back.

[0117] The application service node sends a second-stage operation execution instruction to each target data shard according to the main transaction state, wherein, if the main transaction state is to be committed, the second-stage operation is a confirmation operation, the resource data of the accounting account is updated according to the pre-frozen data or the un-reached data of each accounting account, and the pre-frozen data or the un-reached data is restored; if the main transaction state is to be rolled back, the second-stage operation is a rollback operation or a cancellation operation, the resource data of each accounting account is not modified, and the pre-frozen data or the un-reached data is directly restored. If the operation result of the first-stage operation of one target data shard is failure, a cancellation operation is performed on the target data shard with a successful operation result of the first-stage operation, and a rollback (cancel) operation is performed on the target data shard with a failed operation result of the first-stage operation.

[0118] After the confirmation operation is completed, the branch transaction state in each target data shard is modified to be committed, and the main transaction state in the management transaction table is modified to be committed; after the cancellation operation is completed, the branch transaction state in each target data shard is modified to be rolled back, and the main transaction state in the management transaction table is modified to be rolled back.

[0119] The accounting operation composed of the first-stage operation and the second-stage operation is a TCC (try, confirm / cancel) accounting mode, wherein the first stage is a try stage, and the second stage is a confirm stage or a cancel stage.

[0120] For examples, refer to Figure 5 A flowchart of the first-stage operation provided by the embodiments of the present application is shown in Figure 5 The process of the target data shard performing the try stage is as follows:

[0121] S51: The target data shard registers the accounting request group in the branch transaction table and locks the accounting transaction.

[0122] Specifically, after the target data shard receives the branch accounting transaction (a local accounting transaction or a remote accounting transaction), the target data shard registers the accounting request group in the branch accounting transaction and locks the branch accounting transaction, that is, the first-stage operation is currently executed, and if other operation instructions are received at this time, the other operation instructions will not be executed on the accounting request group.

[0123] S52: Grouping each accounting request in the accounting request group, and grouping the accounting requests belonging to the same accounting account into one group.

[0124] S53: Determining whether there is an unexecuted accounting request in the accounting request group, if yes, performing S54, and if no, ending the first-stage operation.

[0125] S54: determining the accounting mode for each accounting request, registering the accounting request, and calling the accounting engine to perform data reservation, checking the legality of the remaining data after reserving the resources, completing one accounting request, and re-executing S53.

[0126] It should be noted that if the data reservation fails or the remaining data is not legal during the execution of S54, the accounting of the remaining accounting requests is stopped, and the operation result of the first stage operation is returned as a failure. If all the accounting requests in the accounting request group are executed, the operation result of the first stage operation is returned as a success.

[0127] In a possible implementation, before the operation result of the first stage operation of the plurality of target data shards in S42 or S46 is received, the method can further include:

[0128] If the target data shard of the local server or the target data shard of the remote server is interrupted during the execution of the first stage operation, or the execution time of the first stage operation is greater than the preset time, a rollback instruction is sent to the local server and the remote server, respectively, and the rollback instruction is used to instruct the target data shard of the local server and the target data shard of the remote server to cancel the operation data of the accounting request group that has been executed.

[0129] In this embodiment, the application service node sequentially calls each target data shard to execute the first stage operation in the order of the local server and the remote server. First, the target data shard on the local server executes the first stage operation, and then the target data shards of each remote server sequentially execute the first stage operation. During the execution of the first stage operation of each target data shard, if one target data shard is interrupted, abnormal, or timed out, the application service node stops triggering other target data shards to continue executing the first stage operation, and modifies the main transaction state to be rolled back. Then, a rollback instruction is sent to the target data shard that has executed the first stage operation, so that the target data shard that has executed the first stage operation rolls back the operation of each accounting account in the accounting request group, and cancels the pre-frozen data or the unaccounted data.

[0130] For example, the interruption of the target data shard in executing the first stage operation can be a business error in executing the first stage operation, or a network exception, etc.

[0131] In some embodiments, the data shard identifiers corresponding to each accounting request group are spliced into a string, the string is registered in the main transaction table of the main transaction, and the string is taken as an attribute of the main transaction. When rollback is needed, the string can be used to determine which target data shards to send the rollback instruction to.

[0132] It should be noted that the first stage operation of each target data shard can be executed synchronously or asynchronously, and the second stage operation of each target data shard is executed asynchronously, wherein synchronous execution is that one target data shard is executed and then the next target data shard can start to execute, and asynchronous execution is that multiple target data shards are executed synchronously. Since the second stage operation is only to confirm or cancel the operation result of the first stage operation, asynchronous execution of the second stage operation can reduce the time for processing the accounting request and improve the accounting efficiency on the premise of ensuring the safety of funds.

[0133] Since the first stage operation is executed synchronously, only one target data shard executes the first stage operation each time, and the target data shard executing the first stage operation can be periodically polled by a timing task to determine the execution time of the target data shard executing the first stage operation. If the execution time of the target data shard executing the first stage operation is greater than a preset time, it is determined that the target data shard does not respond, a re-execution instruction is sent to the target data shard, the target data shard rolls back the executed accounting request to an initial state, and the first stage operation is re-executed on the entire accounting request group.

[0134] In a possible implementation, the method can further include:

[0135] If it is detected that the execution time of any target data shard executing the second stage operation is greater than a preset time, an operation re-execution instruction is sent to any target data shard to make any target data shard re-execute the first stage operation or the second stage operation.

[0136] In the embodiment, in the process of each target data shard executing the second stage operation, the target data shard can fail to successfully execute the second stage operation due to various reasons, and the execution result is not returned to the application service node. In order to ensure that each target data shard successfully executes the second stage operation, the operation with the execution time exceeding needs to be re-executed.

[0137] It should be noted that each target data shard has an idempotent interface to ensure that each target data shard has the same execution result as executing once when re-executing the second stage operation multiple times, avoid inaccurate resource data of the accounting account due to multiple execution of the confirmation operation or the cancellation operation, and ensure the safety of the account resource.

[0138] For example, according to the last modification time of each branch transaction table and the state of each branch transaction table, the accounting request group whose branch transaction table is modified more than a preset time from the last modification time and whose state is a non-terminal state can be determined to re-execute the operation. The non-terminal state can be an initial state, a to-be-committed state, or a to-be-rolled-back state, and the terminal state can be a committed state or a rolled-back state.

[0139] The distributed data processing method provided by the above embodiment can realize bottoming out of the accounting operation by re-executing the operation with a time-out, ensure successful execution of operations in each stage, avoid account data errors caused by execution failure, and ensure the security of account data.

[0140] On the basis of the above embodiment, the embodiment of the present application further provides a distributed data processing device applied to a local service node. Please refer to Figure 6 The structural schematic diagram of the distributed data processing device provided by the embodiment of the present application is shown in Figure 6 The device comprises:

[0141] The accounting request receiving module 10 is configured to receive a plurality of accounting requests, and each accounting request comprises an accounting parameter and a data shard identifier;

[0142] The accounting request grouping module 20 is configured to group the plurality of accounting requests according to the data shard identifiers, to obtain at least one accounting request group, so that the data shard identifiers in each accounting request group are the same;

[0143] The data shard determining module 30 is configured to determine, according to the data shard identifiers in each accounting request group and the identifiers of the data shards on the servers, a target data shard corresponding to each accounting request group in a server corresponding to the data shard identifier;

[0144] The accounting instruction execution module 40 is configured to, for the accounting request groups in which the target data shards belong to the same server, call the corresponding server, and execute, in the corresponding server, an accounting instruction in the corresponding target data shard for each accounting request group, the accounting instruction being configured to instruct the target data shard to perform a corresponding accounting operation according to the accounting parameter of the accounting request in each accounting request group.

[0145] Optionally, if the at least one accounting request group is one accounting request group in which the data shard identifiers belong to the same target data shard in the local server, the accounting instruction execution module 40 is specifically configured to call the local server, and execute one local accounting instruction in one target data shard corresponding to the local server for the one accounting request group.

[0146] Optionally, if the at least one accounting request group is a plurality of accounting request groups in which the data shard identifiers belong to a plurality of target data shards in the local server, the accounting instruction execution module 40 comprises:

[0147] The local accounting instruction execution unit is configured to call the local server, and execute a plurality of local accounting instructions in a plurality of target data shards corresponding to the local server for the plurality of accounting request groups, the local accounting instruction being configured to instruct the target data shard to perform a first stage operation of the accounting operation according to the accounting parameter of the accounting request in the corresponding accounting request group.

[0148] an operation result receiving unit, configured to receive operation results of the first-stage operations on the plurality of target data shards;

[0149] a second-stage operation execution unit, configured to execute a plurality of second-stage operation execution instructions in the plurality of target data shards respectively according to the operation results of the first-stage operations, the second-stage operation execution instructions being used to instruct the target data shards to perform second-stage operations on the accounting requests in the accounting request groups.

[0150] Optionally, if the server corresponding to the at least one first accounting request group is the local server and the server corresponding to the at least one second accounting request group is the remote server, the accounting instruction execution module 40 further includes a remote accounting instruction execution unit;

[0151] the local accounting instruction execution unit is further configured to invoke the local server to execute at least one local accounting instruction in at least one target data shard corresponding to the local server for the at least one first accounting request group, the local accounting instruction being used to instruct the target data shard corresponding to the local server to perform the first-stage operation of the accounting operation according to the accounting parameters of the accounting requests in the corresponding accounting request group;

[0152] the remote accounting instruction execution unit is configured to invoke the remote server to execute at least one remote accounting instruction in at least one target data shard corresponding to the remote server for the at least one second accounting request group, the remote accounting instruction being used to instruct the target data shard corresponding to the remote server to perform the first-stage operation of the accounting operation according to the accounting parameters of the accounting requests in the corresponding accounting request group;

[0153] the operation result receiving unit is configured to receive operation results of the first-stage operations on the plurality of target data shards;

[0154] the second-stage operation execution unit is further configured to execute a plurality of second-stage operation execution instructions in the plurality of target data shards of the local server and the remote server respectively according to the operation results of the first-stage operations, the second-stage operation execution instructions being used to instruct the target data shards to perform second-stage operations on the accounting requests in the accounting request groups.

[0155] Optionally, the accounting parameters include an accounting account and to-be-accounted data, and if the resource data of the accounting account in all the target data shards of the operation results of the first-stage operations satisfies the to-be-accounted data, the second-stage operation execution instruction is used to instruct the target data shard to modify the resource data of the accounting account according to the resource data of the accounting account and the to-be-accounted data;

[0156] If the operation result of the first stage operation is that the resource data of the accounting account in the target data shard does not meet the to-be-accounted data, the second stage operation execution instruction is used to instruct the target data shard not to modify the resource data of the accounting account.

[0157] Optionally, before the operation result receiving unit, the apparatus further comprises:

[0158] The rollback module is configured to send a rollback instruction to the local server and the remote server respectively if the target data shard of the local server or the target data shard of the remote server is interrupted during the execution of the first stage operation, or the execution time of the first stage operation is greater than the preset time, the rollback instruction being used to instruct the target data shard of the local server and the target data shard of the remote server to cancel the operation data of the accounting request group.

[0159] Optionally, the apparatus further comprises:

[0160] The re-execution module is configured to send an operation re-execution instruction to any target data shard to make the target data shard re-execute the second stage operation if it is detected that the execution time of the second stage operation of any target data shard is greater than the preset time.

[0161] The apparatus is used to execute the method provided by the foregoing embodiments, and has similar implementation principles and technical effects, which are not described here in detail.

[0162] The modules can be one or more integrated circuits configured to implement the above method, for example, one or more application specific integrated circuits (ASICs), or one or more microprocessors, or one or more field programmable gate arrays (FPGAs), etc. For another example, when a certain module is implemented in the form of a processing element scheduling code, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can invoke code. For another example, the modules can be integrated together to implement in the form of a system on a chip (SOC).

[0163] Please refer to Figure 7A schematic diagram of a computer device provided in the embodiments of the present application is shown in FIG. 1. The computer device 100 includes a processor 101, a storage medium 102, and a bus. The storage medium 102 stores program instructions executable by the processor 101. When the computer device 100 is running, the processor 101 communicates with the storage medium 102 through the bus. The processor 101 executes the program instructions to perform the above-described method embodiments. The specific implementation manners and technical effects are similar, and thus are not described here again.

[0164] Optionally, the embodiments of the present application further provide a computer readable storage medium, which stores a computer program. When the computer program is run by a processor, the above-described method embodiments are executed. The specific implementation manners and technical effects are similar, and thus are not described here again.

[0165] In several embodiments of the present application, it should be understood that the disclosed apparatus and method can be implemented in other manners. For example, the described apparatus embodiments are merely schematic. The division of the units is merely a logical function division. There can be another division manner for the actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.

[0166] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units. That is, they can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments of the present application.

[0167] In addition, each functional unit in the embodiments of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware, or in the form of hardware plus software function units.

[0168] The integrated unit in the form of software function unit can be stored in a computer readable storage medium. The software function unit is stored in a storage medium, and includes a plurality of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute part of steps of the method according to various embodiments of the present application. The storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various storage media capable of storing program codes.

[0169] The above merely describes specific embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method of distributed data processing, characterized by, The method applied to a local service node comprises: receiving a plurality of accounting requests, each accounting request comprising an accounting parameter and a data shard identifier; grouping the plurality of accounting requests according to the data shard identifiers, to obtain at least one accounting request group, so that the data shard identifiers in each accounting request group are the same; determining, according to the data shard identifiers in each accounting request group and the identifiers of data shards on each server, a target data shard corresponding to each accounting request group in a server corresponding to the data shard identifier; for the accounting request groups in which the target data shards belong to the same server, calling the corresponding server to execute, in the corresponding server, an accounting instruction in the corresponding target data shard for each accounting request group, the accounting instruction being used to instruct the target data shard to execute a corresponding accounting operation according to the accounting parameter of the accounting request in each accounting request group; if the server corresponding to at least one first accounting request group in the at least one accounting request group is a local server and the server corresponding to at least one second accounting request group is a remote server, the calling the corresponding server to execute, in the corresponding server, the accounting instruction in the corresponding target data shard for each accounting request group comprises: calling the local server to execute at least one local accounting instruction in at least one target data shard corresponding to the local server for the at least one first accounting request group, the local accounting instruction being used to instruct the target data shard corresponding to the local server to execute a first-stage operation of the accounting operation according to the accounting parameter of the accounting request in the corresponding accounting request group; calling the remote server to execute at least one remote accounting instruction in at least one target data shard corresponding to the remote server for the at least one second accounting request group, the remote accounting instruction being used to instruct the target data shard corresponding to the remote server to execute a first-stage operation of the accounting operation according to the accounting parameter of the accounting request in the corresponding accounting request group; receiving operation results of the first-stage operations of the plurality of target data shards; executing, according to the operation results of the first-stage operations, a plurality of second-stage operation execution instructions in the plurality of target data shards of the local server and the remote server respectively, the second-stage operation execution instruction being used to instruct the target data shard to execute a second-stage operation of the accounting request in the accounting request group; before the receiving the operation results of the first-stage operations of the plurality of target data shards, the method further comprises: if the target data shard of the local server or the target data shard of the remote server interrupts the execution of the first-stage operation or the execution time of the execution of the first-stage operation is greater than a preset time, sending a rollback instruction to the local server and the remote server respectively, the rollback instruction being used to instruct the target data shard of the local server and the target data shard of the remote server to cancel the operation data of the executed accounting request group.

2. The method of claim 1, wherein, If the at least one accounting request group is one accounting request group whose data shards belong to one target data shard in the local server, the calling the corresponding server comprises: calling the local server to execute one local accounting instruction in the corresponding target data shard of the local server for the one accounting request group.

3. The method of claim 1, wherein, If the at least one accounting request group is multiple accounting request groups whose data shards belong to multiple target data shards in the local server, the calling the corresponding server comprises: calling the local server to execute multiple local accounting instructions in the corresponding multiple target data shards of the local server for the multiple accounting request groups, the local accounting instructions being used to instruct the target data shards to perform the first stage operation of the accounting operation according to the accounting parameters of the accounting requests in the corresponding accounting request group; receiving operation results of the first stage operation of the multiple target data shards; respectively executing multiple second stage operation execution instructions in the multiple target data shards according to the operation results of the first stage operation, the second stage operation execution instructions being used to instruct the target data shards to perform the second stage operation on the accounting requests in the accounting request group.

4. The method of claim 1 or 3, wherein, The accounting parameters comprise an accounting account and to-be-accounted data, if the operation result of the first stage operation is that the resource data of the accounting account in all target data shards satisfies the to-be-accounted data, the second stage operation execution instruction is used to instruct the target data shards to modify the resource data of the accounting account according to the resource data of the accounting account and the to-be-accounted data; if the operation result of the first stage operation is that there is one target data shard in which the resource data of the accounting account does not satisfy the to-be-accounted data, the second stage operation execution instruction is used to instruct the target data shards not to modify the resource data of the accounting account.

5. The method of claim 3, wherein, Before the receiving the operation results of the first stage operation of the multiple target data shards, the method further comprises: if the target data shard of the local server or the target data shard of the remote server interrupts the execution of the first stage operation, or the execution time of the execution of the first stage operation is greater than a preset time, respectively sending a rollback instruction to the local server and the remote server, the rollback instruction being used to instruct the target data shard of the local server and the target data shard of the remote server to cancel the operation data of the executed accounting request group.

6. The method of claim 1 or 3, wherein, The method further comprises: if it is detected that the execution time of the second stage operation of any target data shard is greater than a preset time, sending an operation re-execution instruction to the any target data shard, so that the any target data shard re-executes the second stage operation.

7. A distributed data processing apparatus, characterized by The device is applied to a local service node, and the device comprises: The accounting request receiving module is configured to receive a plurality of accounting requests, each of which comprises an accounting parameter and a data shard identifier; The accounting request grouping module is configured to group the plurality of accounting requests according to the data shard identifiers, so as to obtain at least one accounting request group, and the data shard identifiers in each accounting request group are the same; The data shard determining module is configured to determine, according to the data shard identifiers in each accounting request group and identifiers of data shards on respective servers, target data shards corresponding to each accounting request group in a server corresponding to the data shard identifier; The accounting instruction executing module is configured to, for an accounting request group in which the target data shards belong to the same server, call a corresponding server, and execute, in the corresponding server, an accounting instruction for each accounting request group in the corresponding target data shard, the accounting instruction being used to instruct the target data shard to perform a corresponding accounting operation according to an accounting parameter of an accounting request in each accounting request group; If servers corresponding to at least one first accounting request group in the at least one accounting request group are local servers, and servers corresponding to at least one second accounting request group are remote servers, the accounting instruction executing module comprises a local accounting instruction executing unit, a remote accounting instruction executing unit, an operation result receiving unit, and a second-stage operation executing unit; The local accounting instruction executing unit is configured to call the local servers, and execute at least one local accounting instruction for the at least one first accounting request group in at least one target data shard corresponding to the local servers, the local accounting instruction being used to instruct the target data shard corresponding to the local servers to perform a first-stage operation of the accounting operation according to an accounting parameter of an accounting request in a corresponding accounting request group; The remote accounting instruction executing unit is configured to call the remote servers, and execute at least one remote accounting instruction for the at least one second accounting request group in at least one target data shard corresponding to the remote servers, the remote accounting instruction being used to instruct the target data shard corresponding to the remote servers to perform a first-stage operation of the accounting operation according to an accounting parameter of an accounting request in a corresponding accounting request group; The operation result receiving unit is configured to receive operation results of the first-stage operation of the plurality of target data shards; The second-stage operation executing unit is configured to execute, according to the operation results of the first-stage operation, a plurality of second-stage operation executing instructions in the plurality of target data shards of the local servers and the remote servers respectively, the second-stage operation executing instruction being used to instruct the target data shard to perform a second-stage operation on the accounting request in the accounting request group; Before the operation result receiving unit, the apparatus further comprises: A rollback module is configured to send a rollback instruction to the local server and the off-site server respectively if the target data shard of the local server or the target data shard of the off-site server fails to perform the first-stage operation or the execution time of the first-stage operation is greater than a preset time, and the rollback instruction is configured to instruct the target data shard of the local server and the target data shard of the off-site server to cancel the operation data of the accounting request group that has been executed.

8. A computer device, comprising: The distributed data processing method comprises the following steps: A processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, the processor and the storage medium communicate through the bus when the computer device is running, and the processor executes the program instructions to perform the steps of the distributed data processing method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, and the computer program is executed by the processor to perform the steps of the distributed data processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Data reconciliation method, device, equipment and system

    CN109615495A

  • Distributed accounting method, device and system

    CN109978540A