Business processing method and device, computer, storage medium and program product
By splitting business transactions into multiple business processing instructions and defining compensation mechanisms, the problem of inconsistent data changes in multi-component business processing is solved, and the accuracy of business processing and data accuracy are achieved.
Patent Information
- Application Number
- CN202510173795.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-17
- Publication Date
- 2025-06-06
AI Technical Summary
During the multi-component business processing process, inconsistent data changes lead to missing information, affecting the accuracy of business processing.
By splitting business transactions into multiple business processing instructions and defining compensation mechanisms for each instruction, it ensures that when any instruction fails to execute, it can fall back to a consistent state.
The state synchronization of each storage component is realized, improving the accuracy of business processing and data accuracy.
Smart Images

Figure CN120104148A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a business processing method, device, computer, storage medium and program product. Background Art
[0002] In many business processes, multiple processes are often included. For example, similarity detection often includes processes such as feature extraction, vector retrieval, and information query. On this basis, many businesses store information in multiple components. For example, in similarity detection, information is often stored in multiple components, including seed libraries, key-value (kv) libraries, image information libraries (Database, DB) and core databases. At present, when performing business processing, the processing operations of each component, such as addition, deletion, and modification operations, are executed in sequence. If the processing operation for a component fails, the business processing process will be terminated immediately. This also makes the data changes caused by the business processing process to each component inconsistent, resulting in information missing when querying different information of an object in each component. For example, when performing similarity detection, assuming that the processing operation on the seed library fails, the seed data of the image similar to the image to be detected can be obtained, but the abnormal reason of the image to be detected cannot be obtained; for example, assuming that the processing operation on the core database fails, the seed data and related information of the image similar to the image to be detected can be obtained, but the image similar to the image to be detected cannot be obtained, resulting in the inability to prove the abnormal reason of the image to be detected, etc. Therefore, when performing similarity detection on images, some information may not be queried. Since the data in each component may be inconsistent, the data requested for similarity detection may be inconsistent, that is, the accuracy of business processing is low. Summary of the invention
[0003] The embodiments of the present application provide a business processing method, device, computer, storage medium and program product, which can improve the accuracy and detection efficiency of business processing.
[0004] On the one hand, an embodiment of the present application provides a service processing method, the method comprising:
[0005] Obtain a first business transaction, and split the first business transaction into N business processing instructions based on N first storage components associated with the first business transaction; N is a positive integer; each business processing instruction is used to update data of one of the N first storage components; the N business processing instructions include instructions to be processed;
[0006] Obtaining business version information associated with the first storage component corresponding to the instruction to be processed, and obtaining first transaction version information corresponding to the instruction to be processed in the first business transaction; the first transaction version information is used to indicate a theoretical version of the first storage component corresponding to the instruction to be processed;
[0007] If the service version information is the same as the first transaction version information, the pending instruction is executed;
[0008] If the execution of the instruction to be processed fails, the inverse business processing instruction corresponding to the preceding instruction of the instruction to be processed is executed; the inverse business processing instruction corresponding to the preceding instruction of the instruction to be processed is used to roll back the status of the N first storage components to the state before processing the first business transaction; the preceding instruction of the instruction to be processed refers to the business processing instruction among the N business processing instructions that is located before the instruction to be processed.
[0009] An embodiment of the present application provides a service processing device, the device comprising:
[0010] An instruction acquisition module, used to acquire a first business transaction, and split the first business transaction into N business processing instructions based on N first storage components associated with the first business transaction; N is a positive integer; each business processing instruction is used to update data of one of the N first storage components; the N business processing instructions include pending instructions;
[0011] A version acquisition module, used to acquire business version information associated with the first storage component corresponding to the instruction to be processed, and acquire first transaction version information corresponding to a predecessor transaction of the first business transaction; the predecessor transaction of the first business transaction refers to a transaction generated before the first business transaction;
[0012] An instruction processing module, configured to execute the instruction to be processed if the service version information is the same as the first transaction version information;
[0013] A state rollback module is used to execute the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed if the execution of the instruction to be processed fails; the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is used to roll back the state of the N first storage components to the state before processing the first business transaction; the preceding instruction of the instruction to be processed refers to the business processing instruction among the N business processing instructions that is located before the instruction to be processed.
[0014] The device further comprises:
[0015] A parameter acquisition module, used to acquire instruction processing parameters respectively included in the first N-1 business processing instructions among the N business processing instructions, and acquire inverse processing parameters respectively corresponding to the first N-1 instruction processing parameters from the operation language of the first storage component respectively corresponding to the first N-1 business processing instructions;
[0016] The instruction generation module is used to generate business processing inverse instructions corresponding to the first N-1 business processing instructions based on the operation languages corresponding to the first N-1 first storage components and the inverse processing parameters corresponding to the first N-1 instruction processing parameters.
[0017] The device further comprises:
[0018] A data acquisition module, used to acquire a generation timestamp of a first business transaction and M business transactions generated at the generation timestamp; the M business transactions include the first business transaction; M is a positive integer;
[0019] The version generation module is used to generate transaction version information corresponding to the M business transactions based on the generation timestamp and the generation order of the M business transactions.
[0020] The device further comprises:
[0021] A relationship detection module, used for detecting the data association relationship between the N first storage components, and determining the first storage component with the data association relationship among the N first storage components as the data association component;
[0022] The version acquisition module is further used to execute a process of acquiring business version information associated with the first storage component corresponding to the instruction to be processed if the instruction to be processed is a data-related component;
[0023] The instruction execution module is used for executing the instruction to be processed if the instruction to be processed is not a data-related component.
[0024] The device further comprises:
[0025] a version reprocessing module, configured to reacquire the business version information associated with the first storage component corresponding to the instruction to be processed if the business version information is different from the first transaction version information, until the number of times the business version information is reacquired is greater than or equal to a version retry number threshold, or the reacquired business version information is the same as the first transaction version information;
[0026] The state rollback module is also used to execute the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed if the number of times the business version information is re-acquired is greater than or equal to the version retry number threshold.
[0027] The device further comprises:
[0028] A version determination module, configured to obtain second transaction version information corresponding to the first business transaction if the instruction to be processed is executed successfully;
[0029] The version determination module is further used to determine the second transaction version information as the business version information of the first storage component corresponding to the instruction to be processed.
[0030] The device further comprises:
[0031] The service processing module is used to deploy A service nodes and obtain the node association interfaces corresponding to the A service nodes respectively; A is a positive integer;
[0032] The service processing module is further used to deploy data synchronization functions for the A service nodes respectively through the node association interfaces respectively corresponding to the A service nodes;
[0033] The service processing module is also used to determine the main service node from A service nodes. When processing the first business transaction through the main service node, the transaction processing status of the first business transaction is synchronized to the slave service node through the data synchronization function of the main service node; the slave service node is a service node other than the main service node among the A service nodes; the transaction processing status is used to indicate the status of N first storage components during the first business transaction processing.
[0034] The device further comprises:
[0035] The exception handling module is used to find a candidate service node that is operating normally from the slave service nodes if an exception occurs in the main service node;
[0036] The exception handling module is further configured to, if a candidate service node is found, redetermine a primary service node from the candidate service nodes, and continue to process the first business transaction through the redetermined primary service node;
[0037] The exception handling module is also used to store the transaction processing status of the first business transaction if no candidate service node is found, send a node exception prompt message to the management object, and when there is a normally operating first service node, continue to process the first business transaction in the first service node through the transaction processing status of the first business transaction.
[0038] When the first business transaction is split into N business processing instructions based on the N first storage components associated with the first business transaction, the instruction acquisition module may be used to:
[0039] Obtain B storage components included in the business scenario to which the first business transaction belongs, and obtain N subtransactions included in the first business transaction; B is a positive integer greater than or equal to N;
[0040] From the B storage components, first storage components respectively associated with the N subtransactions are determined, and based on the N subtransactions and the first storage components associated with each subtransaction, business processing instructions respectively corresponding to the N subtransactions are generated.
[0041] Among them, B storage components include an information database, a result seed library, a seed information library and an original database; the information database includes seed data of business data and seed description information associated with the seed data; the result seed library includes transaction processing results of business transactions and business detection results of data detection services; the seed information library includes seed data and reasons for data entry; the original database includes business data; the device also includes:
[0042] A data detection module, configured to generate first seed data of first service data included in the first data detection service in response to a processing operation for the first data detection service;
[0043] The data detection module is further used to search for the first seed data from the result seed library, and if the first seed data is found, determine the business detection result associated with the first seed data as the first business detection result for the first business data;
[0044] The data detection module is also used to obtain the seed data included in the seed information library and the information database if the first seed data is not found, obtain the data similarity between the seed data and the first seed data, determine the seed data with data similarity greater than or equal to the data similarity threshold as the associated seed data of the first seed data, determine the data entry reason corresponding to the associated seed data as the first business detection result for the first business data, and add the first seed data and the first business detection result to the result seed library.
[0045] The status rollback module can be used for:
[0046] If the instruction to be processed is a business processing instruction associated with the seed information library, when the execution of the instruction to be processed fails, the business data to be processed is obtained from the instruction to be processed, and the seed data to be processed of the business data to be processed is obtained;
[0047] Obtaining seed description information associated with the seed data to be processed from the information database, and adding the data entry reason in the seed description information associated with the seed data to be processed and the seed data to be processed to the seed information database;
[0048] If the addition to the seed information database fails, the process of executing the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is executed.
[0049] The status rollback module can be used for:
[0050] If the first storage component associated with the pending instruction is a storage component for storing business data, when the execution of the pending instruction fails, the pending instruction is added to an asynchronous compensation queue for the first storage component associated with the pending instruction;
[0051] Scanning the asynchronous compensation queue through the asynchronous processing thread, when obtaining the instruction to be processed, adding the second business data associated with the instruction to be processed to the first storage component associated with the instruction to be processed;
[0052] If the first storage component associated with the instruction to be processed is not a storage component for storing business data, when the execution of the instruction to be processed fails, the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is executed.
[0053] On the one hand, an embodiment of the present application provides a computer device, including a processor, a memory, and an input and output interface;
[0054] The processor is connected to the memory and the input and output interface respectively, wherein the input and output interface is used to receive and output data, the memory is used to store computer programs, and the processor is used to call the computer program so that the computer device including the processor executes the business processing method in one aspect of an embodiment of the present application.
[0055] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is suitable for being loaded and executed by a processor so that a computer device having the processor executes the business processing method in one aspect of the embodiment of the present application.
[0056] In one aspect, an embodiment of the present application provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in various optional ways in one aspect of the embodiment of the present application. In other words, when the computer instruction is executed by the processor, the method provided in various optional ways in one aspect of the embodiment of the present application is implemented.
[0057] Implementing the embodiments of the present application will have the following beneficial effects:
[0058] In an embodiment of the present application, a first business transaction is obtained, and based on N first storage components associated with the first business transaction, the first business transaction is split into N business processing instructions; N is a positive integer; each business processing instruction is used to update data of one of the N first storage components; the N business processing instructions include an instruction to be processed; business version information associated with the first storage component corresponding to the instruction to be processed is obtained, and first transaction version information corresponding to the instruction to be processed in the first business transaction is obtained; the first transaction version information is used to indicate the theoretical version of the first storage component corresponding to the instruction to be processed. If the business version information is the same as the first transaction version information, the instruction to be processed is executed; if the execution of the instruction to be processed fails, the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is executed; the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is used to roll back the status of the N first storage components to the status before processing the first business transaction; the preceding instruction of the instruction to be processed refers to the business processing instruction that is located before the instruction to be processed among the N business processing instructions. In the present application, business transaction splitting and multi-storage component version unification are introduced in the process of processing the first business transaction. Specifically, the first business transaction is split based on the N first storage components associated with the first business transaction to obtain a series of small independent operations (i.e., business processing instructions), and a compensation mechanism is defined for the business processing instructions, that is, the business processing inverse instructions corresponding to each business processing instruction. Therefore, when any business processing instruction fails to execute, the states of the N first storage components can be rolled back to a consistent state. In other words, for the same business transaction, it can be achieved that each first storage component is either updated based on the business transaction or not updated based on the business transaction, thereby achieving state synchronization of each first storage component and improving the accuracy of business processing. At the same time, based on the transaction version information of the business transaction and the business version information of each storage component, the state consistency of each storage component is guaranteed, thereby improving the accuracy of business processing and the data accuracy of the storage component. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0060] Figure 1 This is a network interaction architecture diagram of a business processing provided by an embodiment of the present application;
[0061] Figure 2This is an optional business processing architecture diagram provided in an embodiment of the present application;
[0062] Figure 3 This is a schematic diagram of a business processing scenario provided by an embodiment of the present application;
[0063] Figure 4 It is a flow chart of a method for business processing provided by an embodiment of the present application;
[0064] Figure 5 This is a schematic diagram of a multi-transaction processing scenario provided by an embodiment of the present application;
[0065] Figure 6 is another schematic diagram of a multi-transaction processing scenario provided by an embodiment of the present application;
[0066] Figure 7 This is a schematic diagram of a business transaction processing scenario provided by an embodiment of the present application;
[0067] Figure 8 This is a schematic diagram of an optional business transaction processing scenario provided in an embodiment of the present application;
[0068] Fig. 9 This is a flowchart of a specific method for business processing provided by an embodiment of the present application;
[0069] Fig.10 This is a schematic diagram of an instruction for a business transaction provided in an embodiment of the present application;
[0070] Fig.11 It is a schematic diagram of an optional instruction of a business transaction provided by an embodiment of the application;
[0071] Fig.12 It is a schematic diagram of a service processing device provided in an embodiment of the present application;
[0072] Fig.13 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0073] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0074] Among them, if it is necessary to collect object (such as user, etc.) data in this application, a prompt interface or pop-up window will be displayed before and during the collection. The prompt interface or pop-up window is used to prompt the user that certain data (such as business data, etc.) is currently being collected. Only after the user confirms the prompt interface or pop-up window, the relevant steps of data acquisition are started, otherwise the process ends. Moreover, the acquired user data will be used in reasonable and legal scenarios or purposes. Optionally, in some scenarios where user data needs to be used but is not authorized by the user, authorization can be requested from the user, and the user data can be used when the authorization is passed. In other words, this application will use the acquired user data within a reasonable and legal scope.
[0075] The concepts of the relevant technical terms involved in the embodiments of the present application are explained below:
[0076] 1. A business transaction refers to an operation sequence consisting of instruction operations indicated by one or more different business processing instructions. These instruction operations in the operation sequence are either all executed or not executed at all. In an embodiment of the present application, when a computer device obtains a business transaction, it can split the business transaction into multiple business processing instructions based on a storage component associated with the business transaction. At this time, each business processing instruction can specifically be an instruction parsed from the business transaction obtained by the computer device, and the business transaction includes transaction information.
[0077] For example, when the business transaction is a resource transfer business in the financial field (such as a transaction transfer business, etc.), when the transaction information involved in the resource transfer business is to transfer a certain amount of virtual resources from one account to another account, the instruction operation indicated by each business processing instruction in the transaction information can be equivalently regarded as an operation sequence composed of a series of instruction operations. For example, in an embodiment of the present application, these instruction operations specifically include operations for multiple storage components (for example, storage component Y1 and storage component Y2, etc., where storage component Y1 can be account U1 and storage component Y2 can be account U2), for example, a read operation to read the account balance of account U1, a calculation operation to calculate the latest account balance after deducting a certain amount of virtual resources from the account U1, and a write operation to store the latest account balance of the account U1, as well as a read operation to read the account balance of account U2, a calculation operation to calculate the latest account balance after adding a certain amount of virtual resources to the account U2, and a write operation to store the latest account balance of the account U2, etc.
[0078] For another example, when the business transaction is a similarity detection business in the field of image processing (i.e., detecting the similarity between different images), when the transaction information involved in the similarity detection business performs similarity detection between images and stores evidence, the instruction operations indicated by each business processing instruction in the transaction information can be equivalently regarded as an operation sequence composed of a series of instruction operations. For example, in an embodiment of the present application, these instruction operations specifically include operations for multiple storage components (e.g., a seed library, a key-value library, an image information library, and a core database, etc.), such as a read operation to search for seed data similar to the seed data of the image to be detected from the image information library and the key-value library, a write operation to store evidence of the similar seed data found in the seed library, and a write operation to store evidence of the image to be detected in the core database, etc.
[0079] 2. Storage components refer to storage spaces used to store data, such as databases, data pools, data lakes, or queues, etc., which are not restricted here.
[0080] In the examples of this application, see Figure 1 , Figure 1 is a network interaction architecture diagram of a business processing provided by an embodiment of the present application, such as Figure 1As shown, the computer device 101 can perform data interaction with one or more business devices (such as business device 102a, business device 102b, and business device 102c, etc.). Specifically, the computer device 101 can obtain a first business transaction and process the first business transaction through the present application, wherein the computer device 101 can obtain the first business transaction from a local storage space, or can obtain the first business transaction from any one or more business devices. Specifically, the computer device 101 can split the first business transaction into multiple business processing instructions based on the first storage component associated with the first business transaction, and generate business processing inverse instructions corresponding to each business processing instruction. The business processing inverse instruction can be considered as the inverse operation of the corresponding business processing instruction, and is used to roll back the state of the first storage component to the state before the corresponding business processing instruction is executed. For example, the first storage component 1 stores data 1 to data 10, and the business processing instruction 1 is used to add data 11 to the first storage component 1. After the business processing instruction 1 is executed, the first storage component 1 stores data 1 to data 11. At this time, after the business processing inverse instruction 1 corresponding to the business processing instruction 1 is executed, the first storage component 1 stores data 1 to data 10. The computer device 101 can execute each business processing instruction to complete the first business transaction, and when any business processing instruction fails to execute during the execution of each business processing instruction, the business processing inverse instruction corresponding to each business processing instruction can be used to achieve the state unification of the first storage component associated with the first business transaction. At the same time, when executing various business processing instructions, the computer device 101 can unify the version of the first storage component associated with the first business transaction, thereby resolving the concurrency conflicts of multiple business transactions and avoiding the problem of reduced concurrency caused by the use of distributed locks and long transactions, thereby improving the accuracy of business processing and the state consistency of storage components.
[0081] Optionally, the computer device may include multiple service nodes, each of which is used to provide business processing services to implement the solution in this application. For details, see Figure 2 , Figure 2 This is an optional business processing architecture diagram provided by the embodiment of the present application. Figure 2As shown, the computer device 201 may include multiple service nodes, such as service node 201a, service node 201b and service node 201c. In a possible business processing scenario, the computer device 201 can obtain the transaction information of the first business transaction sent by the business device 202 through any service node, and process the first business transaction through the service node. In a possible business scenario, the computer device 201 can respond to the business processing request through any service node, and process the first business transaction associated with the business processing request through the service node. Among them, when the service node is abnormal, the service node can be replaced to continue processing the first business transaction, and there is idempotence between each service node, so that the efficiency and reliability of business processing can be improved. Among them, the service node has idempotence, which means that no matter how many times a certain operation is executed, the state change of the service node is consistent, which can prevent data inconsistency caused by repeated requests.
[0082] For details, see Figure 3 , Figure 3 Schematic diagram of a business processing scenario provided by an embodiment of the present application. Figure 3As shown, the computer device can obtain the first business transaction 301, and split the first business transaction 301 into N business processing instructions 303 based on the N first storage components associated with the first business transaction 301. Wherein, N is a positive integer, for example, the N first storage components may include the first storage component 302a, the first storage component 302b and the first storage component 302c, etc. At this time, the computer device can split the first business transaction 301 to obtain N business processing instructions 303, which may include the business processing instruction 303a corresponding to the first storage component 302a, the business processing instruction 303b corresponding to the first storage component 302b, and the business processing instruction 303c corresponding to the first storage component 302c. Wherein, each business processing instruction is used to update data of one of the N first storage components, such as the business processing instruction 303a is used to update data of the first storage component 302a, the business processing instruction 303b is used to update data of the first storage component 302b, and the business processing instruction 303c is used to update data of the first storage component 302c. Further, the computer device may generate a business processing inverse instruction 304 corresponding to the N business processing instructions 303, and the business processing inverse instruction 304 includes business processing inverse instructions corresponding to the first N-1 business processing instructions in the N business processing instructions 303, such as a business processing inverse instruction 304a corresponding to the business processing instruction 303a, and a business processing inverse instruction 304b corresponding to the business processing instruction 303b, etc. The business processing inverse instruction of a business processing instruction is used to roll back the state of the first storage component targeted by the business processing instruction to the state before the business processing instruction is executed.
[0083] Among them, the N business processing instructions 303 include a pending instruction, which is any one of the N business processing instructions 303. The computer device can obtain the business version information associated with the first storage component corresponding to the pending instruction, and obtain the first transaction version information corresponding to the pending instruction in the first business transaction, wherein the transaction version information is used to indicate the version of the corresponding business transaction (such as the first business transaction or the predecessor transaction of the first business transaction, etc.), the first transaction version information is used to indicate the theoretical version of the first storage component corresponding to the pending instruction, and the business version information is used to perform multi-storage component consistency detection on the corresponding first storage component, and can be used to indicate the version of the first storage component in the business transaction (which can be referred to as the transaction version). Further, if the business version information is the same as the first transaction version information, it means that the transaction version of the first storage component corresponding to the pending instruction matches the transaction version of other first storage components in the N first storage components, and the computer device can execute the pending instruction. Furthermore, if the execution of the instruction to be processed fails, the computer device may execute the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed, so that the state of the N first storage components can be rolled back to the state before the first business transaction was processed. For example, assuming that the instruction to be processed is the business processing instruction 303b, at this time, the preceding instruction of the instruction to be processed is the business processing instruction 303a. If the execution of the business processing instruction 303b fails, the business processing inverse instruction 304a corresponding to the business processing instruction 303a is executed, so that the state of the N first storage components at this time is the state before the first business transaction is processed, and the synchronous processing of the N business processing instructions constituting the first business transaction is realized. The synchronous processing here means that the N business processing instructions can either be fully executed or not executed at all, thereby improving the state consistency of the N first storage components, improving the accuracy of business processing, and improving the data consistency of each storage component.
[0084] It is understandable that the computer devices or business devices mentioned in the embodiments of the present application include but are not limited to terminal devices or servers. In other words, the computer device can be a server or a terminal device, or it can be a system composed of a server and a terminal device. Among them, the terminal device mentioned above can be an electronic device, including but not limited to mobile phones, tablet computers, desktop computers, laptop computers, PDAs, vehicle-mounted devices, augmented reality / virtual reality (AR / VR) devices, helmet displays, smart TVs, wearable devices, smart speakers, digital cameras, cameras and other mobile Internet devices (mobile internet device, MID) with network access capabilities, or terminal devices in scenarios such as trains, ships, and flights. Such as Figure 1As shown in , the terminal device may be a laptop computer (as shown in the service device 102b), a mobile phone (as shown in the service device 102c), or a vehicle-mounted device (as shown in the service device 102a), etc. Figure 1 Only some of the devices are listed, and optionally, the business device 102a refers to a device located in the vehicle 103, and the business device 102a can be used to manage the storage component 1021. The server mentioned above can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, vehicle-road collaboration, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0085] Optionally, the data involved in the embodiments of the present application (such as transaction information of the first business transaction, etc.) can be stored in a computer device, or the data can be stored based on cloud storage technology or a blockchain network, without limitation here.
[0086] For further information, see Figure 4 , Figure 4 This is a flow chart of a method for business processing provided by an embodiment of the present application. Figure 4 As shown, the business processing process includes the following steps:
[0087] Step S401: obtain a first business transaction, and split the first business transaction into N business processing instructions based on N first storage components associated with the first business transaction.
[0088] In an embodiment of the present application, a computer device may respond to a business processing request and obtain a first business transaction corresponding to the business processing request, wherein the business processing request may be sent by a business device or triggered on a computer device. The computer device may obtain N first storage components associated with the first business transaction and split the first business transaction into N business processing instructions, wherein the first storage component refers to a storage component in which data will be updated when the first business transaction is executed. Wherein, N is a positive integer; each business processing instruction is used to update data on a first storage component among the N first storage components, that is, any business processing instruction is used to update data on the first storage component corresponding to the business processing instruction. Wherein, the N business processing instructions include pending instructions, and the pending instructions may refer to any one of the N business processing instructions.
[0089] Optionally, the computer device may obtain B storage components included in the business scenario to which the first business transaction belongs, and obtain N sub-transactions included in the first business transaction; B is a positive integer greater than or equal to N. For example, the business scenario is a resource transfer scenario, and the B storage components included in the business scenario may include object accounts of various business objects (i.e., users) under the business scenario, and optionally, may also include transit accounts for resource transfers of various object accounts. For another example, the business scenario is a scenario involving seed data, and the B storage components included in the business scenario may include an information database, a result seed library, a seed information library, and an original database; the information database includes seed data of business data and seed description information associated with the seed data, and the information database can be used to store persistent data; the result seed library includes the transaction processing results of the business transaction, and the business detection results of the data detection business; the seed information library includes seed data and the reason for data entry, and the seed information library can be used to store temporary data; the original database includes business data, etc. The above are several business scenarios that can be applied to the present application as examples, and can also be applied to business scenarios involving multiple storage components and business transactions that can be split into multiple operations, which are not limited here. For example, assuming that the business scenario is an image similarity detection scenario, in this case, the information database may be an image information database (Database, DB), the business data is an image, and the seed description information may include the reason for data entry of the image and image parameters, etc. For example, the similarity detection scenario is used to perform anomaly detection on images, then the reason for data entry may be the anomaly reason of the corresponding image. Optionally, the image information database may also include log information of the business scenario, etc.; the result seed library may be a seed library, in this case, the transaction processing result of the business transaction may include the seeds of the first P images similar to the image to be detected. Sub-data, P is a positive integer; the seed information library can be a key-value library (KV), and the seed information library can also include the data source of the seed data. For example, the similarity detection scenario is used to detect anomalies in images, and the reason for the data entry can be the abnormal reason of the corresponding image, such as system abnormality and interface without permission; the original database can be a core database (COS), and the business data in the core database can be persistent image data, which can be used for evidence storage. For example, when the similarity detection scenario is used to detect anomalies in images, the image data can be considered to be abnormal image data, etc.
[0090] Furthermore, the computer device can determine the first storage components associated with N subtransactions from B storage components, and generate business processing instructions corresponding to the N subtransactions based on the N subtransactions and the first storage components associated with each subtransaction. Specifically, the computer device can obtain the component programming language of the first storage component associated with the ith subtransaction, use the component programming language to generate instructions for the ith subtransaction, and obtain the business processing instruction corresponding to the ith subtransaction. For example, the ith subtransaction is an operation of writing business data 1 into table 1 in database 1, and the component programming language of the first storage component associated with the ith subtransaction is structured query language (SQL), then the business processing instruction corresponding to the ith subtransaction can be "insert into database 1. table 1 (table header item of table 1) values (business data 1)", etc. Similarly, the business processing instructions corresponding to the N subtransactions can be obtained.
[0091] Further, step S402 may be executed to obtain the business version information associated with the first storage component corresponding to the instruction to be processed, and obtain the first transaction version information corresponding to the instruction to be processed in the first business transaction. Alternatively, the computer device may detect the data association relationship between N first storage components, and determine the first storage component with a data association relationship among the N first storage components as a data association component; the data association relationship is used to indicate that there is a data consistency requirement between the corresponding first storage components (i.e., the data association component), that is, the data association component needs to synchronously update the data in the first business transaction. If the instruction to be processed is a data association component, step S402 is executed to obtain the business version information associated with the first storage component corresponding to the instruction to be processed; if the instruction to be processed is not a data association component, the instruction to be processed is executed, and step S405 is executed.
[0092] Step S402: obtain business version information associated with the first storage component corresponding to the instruction to be processed, and obtain first transaction version information corresponding to the instruction to be processed in the first business transaction.
[0093] In an embodiment of the present application, a computer device can obtain business version information (sequence) associated with a first storage component corresponding to an instruction to be processed, where the business version information refers to the version of the first storage component corresponding to the instruction to be processed in the dimension of business transactions; obtain first transaction version information corresponding to the instruction to be processed in the first business transaction, where the first transaction version information is used to indicate the theoretical version of the first storage component corresponding to the instruction to be processed.
[0094] In one version, the business version information can be the transaction version identifier of the business transaction to which the last executed operation belongs for the first storage component corresponding to the pending instruction. For example, the first business transaction is business transaction T1, and the business transaction to which the last executed operation belongs for the first storage component corresponding to the pending instruction is business transaction T2. Then the business version information is the transaction version identifier of business transaction T2. At this time, the first transaction version information is the transaction version identifier corresponding to the predecessor transaction of the first business transaction. The transaction version identifier of any business transaction is the version assigned to the business transaction when processing the business transaction, which is used as the unique identifier of the business transaction. The predecessor transaction of the first business transaction refers to the transaction generated before the first business transaction. For example, business transaction T1 and business transaction T2 are generated in sequence, and the predecessor transaction of business transaction T2 is business transaction T1. In this way, the operation sequence of data update for each first storage component can be made to conform to the processing sequence of business transactions, so that the version consistency of multiple storage components can be achieved, and the accuracy of business processing can be improved.
[0095] In another version case, the computer device can obtain the operation type and the data to be updated of the instruction to be processed, and generate the business version information of the first storage component corresponding to the instruction to be processed according to the operation type and the data to be updated. At this time, the business version information can be used to indicate the business transaction that will update the data for the first storage component corresponding to the instruction to be processed, that is, it can indicate the business transaction to which the instruction to be processed belongs. Among them, the operation type is used to indicate the operation of the instruction to be processed, such as the update operation type (update), the increase operation type (add) and the deletion operation type (delete), etc., which are not limited here. The computer device can obtain the first associated component of the first storage component corresponding to the instruction to be processed from the N first storage components, and determine the business version information of the first associated component as the first transaction version information corresponding to the instruction to be processed in the first business transaction. The first transaction version information can be used to indicate the business transaction to which the business processing instruction recently executed for the first associated component belongs. Among them, there is a data association relationship between the first associated component and the first storage component corresponding to the instruction to be processed, and the business processing instruction corresponding to the first associated component is located before the instruction to be processed in the N business processing instructions. In this way, the version to be updated of the first storage component corresponding to the instruction to be processed can be consistent with the version corresponding to the first associated component, thereby achieving version consistency of multiple storage components and improving the accuracy of business processing.
[0096] Optionally, the first storage component associated with the instruction to be processed may have multiple versions in different dimensions, one of which is a version in the dimension of business transactions, which is used to perform consistency detection on multiple first storage components, and is used to implement atomic data updates of the first storage component based on compare and swap (CAS) operations when updating data of the corresponding first storage component, so as to avoid data inconsistency problems caused by concurrent modifications of the first storage component; and the other is a version in the dimension of storage components, which is used to indicate the version of the corresponding first storage component data update. Atomicity refers to the indivisibility of business transactions, and all operations of a business transaction (i.e., business processing instructions) are either executed uninterruptedly or not executed at all.
[0097] Step S403: Check whether the service version information is the same as the first transaction version information.
[0098] In an embodiment of the present application, a computer device can detect whether the business version information is the same as the first transaction version information. If the business version information is the same as the first transaction version information, step S404 is executed. If the business version information is different from the first transaction version information, the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is executed, wherein the preceding instruction of the instruction to be processed refers to the business processing instruction located before the instruction to be processed among the N business processing instructions. Alternatively, if the business version information is different from the first transaction version information, the business version information associated with the first storage component corresponding to the instruction to be processed is re-acquired until the number of times the business version information is re-acquired is greater than or equal to the version retry number threshold, or the re-acquired business version information is the same as the first transaction version information. At this time, if the number of times the business version information is re-acquired is greater than or equal to the version retry number threshold, the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is executed; if the re-acquired business version information is the same as the first transaction version information, step S404 is executed to execute the instruction to be processed. That is to say, when the business version information is different from the first transaction version information, the state of the N first storage components can be directly rolled back based on the first business transaction, or the first storage component corresponding to the pending instruction can be subjected to multiple version consistency checks until the version consistency check passes (that is, the re-acquired business version information is the same as the first transaction version information), and step S404 is executed, or until the number of times the business version information is re-acquired is greater than or equal to the version retry number threshold, and the version consistency check of the first storage component corresponding to the pending instruction still fails, the business processing inverse instruction corresponding to the preceding instruction of the pending instruction is executed. Since multiple business transactions are often processed concurrently, and the execution speed and execution interval of the business processing instructions included in each business transaction may not be exactly the same, the business version information corresponding to each storage component may not necessarily be updated in time. Therefore, through multiple version consistency checks, the accuracy of business processing is improved, the occurrence of erroneous termination of business transactions is reduced, and the fault tolerance of business processing is improved.
[0099] Step S404: If the service version information is the same as the first transaction version information, the pending instruction is executed.
[0100] In an embodiment of the present application, the computer device may execute the instruction to be processed to implement data update of the first storage component corresponding to the instruction to be processed.
[0101] Step S405, detecting whether the instruction to be processed is executed successfully.
[0102] In an embodiment of the present application, the computer device can detect whether the pending instruction is executed successfully. If the execution of the pending instruction fails, step S406 is executed; if the execution of the pending instruction is successful, the business version information of the first storage component corresponding to the pending instruction is updated. Specifically, in one version, the computer device can obtain the second transaction version information corresponding to the first business transaction, and the second transaction version information refers to the transaction version identifier of the first business transaction; the second transaction version information is determined as the business version information of the first storage component corresponding to the pending instruction. In another version, the computer device can directly store the business version information of the first storage component corresponding to the pending instruction.
[0103] Step S406: If the execution of the instruction to be processed fails, the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is executed.
[0104] In the embodiment of the present application, the business processing inverse instruction corresponding to the preceding instruction of the pending instruction is used to roll back the state of the N first storage components to the state before processing the first business transaction; the preceding instruction of the pending instruction refers to the business processing instruction that precedes the pending instruction among the N business processing instructions. For example, if a business processing instruction is to write business data 1 in storage component 1, the business processing inverse instruction corresponding to the business processing instruction is to delete business data 1 in storage component 1.
[0105] Optionally, if the execution of the instruction to be processed fails, the computer device can directly execute the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed. Alternatively, if the first storage component associated with the instruction to be processed is a storage component for storing business data, such as a core database, etc., then when the execution of the instruction to be processed fails, the instruction to be processed is added to the asynchronous compensation queue for the first storage component associated with the instruction to be processed, and the asynchronous compensation queue is scanned by the asynchronous processing thread. When the instruction to be processed is obtained, the second business data associated with the instruction to be processed is added to the first storage component associated with the instruction to be processed; if the first storage component associated with the instruction to be processed is not a storage component for storing business data, then when the execution of the instruction to be processed fails, the computer device can execute the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed. Among them, the storage component for storing business data means that only business data is stored in the storage component, that is, the data update delay of the storage component will hardly affect the data consistency of each storage component.
[0106] Optionally, if the pending instruction is a business processing instruction associated with the seed information library, when the pending instruction fails to be executed, the computer device can obtain the pending business data from the pending instruction and obtain the pending seed data of the pending business data. The seed description information associated with the pending seed data is obtained from the information database, and the data storage reason in the seed description information associated with the pending seed data and the pending seed data are added to the seed information library. If the addition to the seed information library fails, the process of the business processing inverse instruction corresponding to the pre-instruction of the pending instruction is executed. In other words, when the execution of the pending instruction fails, the first storage component (such as the seed information library) corresponding to the pending instruction can be synchronized based on other first storage components (such as the information database). Since the data of the seed information library is part of the data of the information database, data synchronization across storage components can be achieved in this way, providing more feasible methods for the execution of the business processing instruction, thereby increasing the probability of successful business transaction processing.
[0107] Further optionally, the computer device may perform data detection on the business data from B storage components. For example, the computer device may generate first seed data of the first business data included in the first data detection business in response to a processing operation for the first data detection business. The first seed data is searched from the result seed library. If the first seed data is found, the business detection result associated with the first seed data is determined as the first business detection result for the first business data. If the first seed data is not found, the seed data included in the seed information library and the information database is obtained, the data similarity between the seed data and the first seed data is obtained, and the seed data with data similarity greater than or equal to the data similarity threshold is determined as the associated seed data of the first seed data, and the data entry reason corresponding to the associated seed data is determined as the first business detection result for the first business data, and the first seed data and the first business detection result are added to the result seed library. Among them, when obtaining the seed data included in the seed information library and the information database, the seed data whose data similarity with the first seed data is greater than or equal to the data similarity threshold can be first searched from the seed information library. If not found, the seed data whose data similarity with the first seed data is greater than or equal to the data similarity threshold is searched from the information database. If found, the seed data whose data similarity with the first seed data is greater than or equal to the data similarity threshold is determined as the associated seed data of the first seed data. Since the seed information library is used to store temporary data, the data of the seed information library is part of the data in the information database. The data required for the first data detection service can be first searched from the seed information library. If not found, the data required for the first data detection service can be searched from the information database, thereby improving the efficiency of data processing and reducing the resources consumed by the data detection service.
[0108] For example, assuming that the business scenario is an image similarity detection scenario, specifically assuming that it is used to detect anomalies on images. The computer device can respond to the processing operation for the first data detection business, generate the first seed data of the first business data (here it can be considered as the image to be detected) included in the first data detection business; search the first seed data from the seed library, if the first seed data is found, then the business detection result associated with the first seed data is determined as the first business detection result for the first business data, at this time, the business detection result associated with the first seed data can include the seed data of the first P images similar to the first seed data, etc. If the first seed data is not found, the data similarity between the seed data and the first seed data can be obtained from the seed data included in the key-value library and the image information library, and the seed data with data similarity greater than or equal to the data similarity threshold is determined as the associated seed data of the first seed data, and the data storage reason corresponding to the associated seed data is determined as the first business detection result for the first business data, so that the abnormal reason of the first business data can be obtained. Optionally, the first seed data and the first business detection result can be added to the seed library, and the associated seed data can also be added to the seed library. Of course, if there is no seed data in the seed data whose data similarity with the first seed data is greater than or equal to the data similarity threshold, the normal image result is determined as the first service detection result for the first service data.
[0109] In the embodiment of the present application, by introducing business transaction splitting and multi-storage component version unification in the process of processing business transactions, the accuracy of business processing is improved, and when processing multiple business transactions in parallel, the data consistency of multiple storage components can also be achieved. By splitting the first business transaction into multiple business processing instructions and generating business processing inverse instructions corresponding to each business processing instruction to compensate for the first business transaction, data intrusion can be avoided, and problems such as computer device anomalies, operating system anomalies and concurrent write conflicts can be solved, thereby improving the accuracy of business processing. By unifying the versions of multiple storage components, the state of the data of each storage component can be kept consistent, thereby reducing the occurrence of concurrent dirty read and dirty write problems, solving conflict problems such as concurrent write failure problems, etc., and improving the concurrency when using distributed locks and long transactions. Among them, dirty reading refers to reading the data submitted by another business transaction during the processing of a business transaction; dirty writing refers to when two business transactions update the same data at the same time, business transaction T1 updates the data without submitting it, and business transaction T2 updates the data at the same time and submits it. At this time, business transaction T1 rolls back the update, which will cause the data update of business transaction T2 to be invalid.
[0110] For example, assume that the computer device sequentially obtains the business processing instructions of business transaction T1 for the image information library (which can be simply referred to as business processing instructions T1.1), the business processing instructions of business transaction T2 for the image information library (which can be simply referred to as business processing instructions T2.1), the business processing instructions of business transaction T2 for the key-value library (which can be simply referred to as business processing instructions T2.2), the business processing instructions of business transaction T1 for the seed library (which can be simply referred to as business processing instructions T1.2), the business processing instructions of business transaction T1 for the key-value library (which can be simply referred to as business processing instructions T1.3), and the business processing instructions of business transaction T1 for the core database (which can be simply referred to as business processing instructions T1.4).
[0111] In one version, see Figure 5 , Figure 5 Schematic diagram of a multi-transaction processing scenario provided by an embodiment of the present application. Figure 5As shown, in business transaction T1, processing is performed on the image information library (i.e., executing the business processing instructions for the image information library in business transaction T1). At this time, the business version information of the image information library is the transaction version identifier of business transaction T1. In business transaction T2, processing is performed on the image information library (i.e., executing the business processing instructions for the image information library in business transaction T2). The computer device can obtain the business version information of the image information library as the transaction version identifier of business transaction T1, and determine the transaction version identifier of the predecessor transaction of business transaction T2 as the first transaction version information corresponding to the business processing instructions for the image information library in business transaction T2. The predecessor transaction of business transaction T2 is business transaction T1. At this time, the business version information of the business processing instructions for the image information library in business transaction T2 is the same as the first transaction version information, and the business processing instructions for the image information library in business transaction T2 can be executed. Further, the computer device obtains the business processing instruction for the key-value library in the business transaction T2 (which can be referred to as the business processing instruction T2.2 for short), obtains the business version information of the key-value library, and identifies the transaction version identifier of the predecessor transaction of the business transaction T2 as the first transaction version information corresponding to the business processing instruction T2.2. Since the key-value library is not updated in the business transaction T1, the business version information of the key-value library is different from the first transaction version information corresponding to the business processing instruction T2.2 at this time. The computer device can perform a version consistency check and retry the business processing instruction T2.2. At the same time, the computer device obtains the business processing instruction for the seed library in the business transaction T1 (which can be referred to as the business processing instruction T1.2 for short). Assuming that the seed library and the core database are not data-related components, the computer device can directly execute the business processing instruction T1.2 at this time. The computer device obtains the business processing instruction for the key-value library in business transaction T1 (which can be referred to as business processing instruction T1.3 for short). Assuming that the version consistency check of the business processing instruction T1.3 passes, the business processing instruction T1.3 is executed, and the transaction version identifier of the business transaction T1 is determined as the business version information of the key-value library. At this time, in business transaction T2, the version consistency check of the business processing instruction T2.2 can pass, and the business processing instruction T2.2 is executed. Further, the computer device obtains the business processing instruction for the core database in business transaction T1 (which can be referred to as business processing instruction T1.4 for short), and the business processing instruction T1.4 can be executed.
[0112] In another version, see Figure 6 , Figure 6 Schematic diagram of another multi-transaction processing scenario provided by an embodiment of the present application. Figure 6As shown, assuming that the seed library and the core database are not data-associated components, and the image information library does not have a first associated component, when the computer device obtains the business processing instruction T1.1, it can execute the business processing instruction T1.1. The computer device obtains the business processing instruction T2.1 and can execute the business processing instruction T2.1. When the computer device obtains the business processing instruction T2.2, it can obtain the business version information of the key-value library, corresponding to the business transaction T2, and the business version information of the first associated component of the key-value library (here is the image information library) corresponds to the business transaction T2, that is, the business version information corresponding to the business processing instruction T2.2 is the same as the first transaction version information, and the business processing instruction T2.2 can be executed. The computer device obtains the business processing instruction T1.2 and can execute the business processing instruction T1.2. The computer device obtains the business processing instruction T1.3. At this time, the business version information of the business processing instruction T1.3 corresponds to the business transaction T1, and the first associated component of the key-value library (here refers to the image information library) has updated the data based on the business transaction T2, that is, the first transaction version information of the business processing instruction T1.3 corresponds to the business transaction T2. That is, it can be considered that the business version information of the business processing instruction T1.3 is different from the first transaction version information, and the business processing instruction T1.3 can be retried for version consistency detection until the business transaction T1 fails or is completed.
[0113] Through the above process, version consistency processing of multiple storage components can be achieved, and data consistency processing of multiple storage components can be achieved, thereby improving the accuracy of business processing.
[0114] For details, see Figure 7 , Figure 7 Schematic diagram of a business transaction processing scenario provided by an embodiment of the present application. Figure 7As shown, assuming that the first business transaction is associated with N first storage components, which can be recorded as first storage component 1 to first storage component N, the first business transaction is split into N business processing instructions based on the N first storage components, such as business processing instruction 1 corresponding to first storage component 1, business processing instruction 2 corresponding to first storage component 2, ..., and business processing instruction N corresponding to first storage component N. At this time, the computer device can perform version detection initialization, perform version consistency detection on business processing instruction 1, and if the version consistency detection of business processing instruction 1 fails, return to perform version detection initialization to retry processing the first business transaction; if the version consistency detection of business processing instruction 1 succeeds, business processing instruction 1 is executed. If the execution of business processing instruction 1 fails, the processing of the first business transaction is terminated; if the execution of business processing instruction 1 succeeds, business processing instruction 2 is processed. Further, when processing business processing instruction 2, a version consistency check is performed on business processing instruction 2. If the version consistency check of business processing instruction 2 fails, the business processing inverse instruction 1 corresponding to business processing instruction 1 is executed. When the execution of business processing inverse instruction 1 fails, asynchronous compensation (Asynccompensate) is performed. When the execution of business processing inverse instruction 1 is successful, return to perform version detection initialization. If the version consistency check of business processing instruction 2 is successful, business processing instruction 2 is executed. If the execution of business processing instruction 2 fails, the business processing inverse instruction 1 corresponding to business processing instruction 1 is executed, and after the execution of business processing inverse instruction 1 is successful, the processing of the first business transaction is terminated; if the execution of business processing instruction 2 is successful, the next business processing instruction of business processing instruction 2 is executed until all N business processing instructions are successfully executed, or the processing of the first business transaction is terminated. Among them, asynchronous compensation is used to provide a recovery mechanism for the business processing inverse instruction when the execution of the business processing inverse instruction fails.
[0115] Optionally, when processing any business processing instruction, it is possible to first detect whether the business processing instruction is a data-related instruction. If the business processing instruction is a data-related instruction, a version consistency check is performed on the first storage component corresponding to the business processing instruction; if the business processing instruction is not a data-related instruction, the business processing instruction is executed. Optionally, if the first storage component corresponding to the business processing instruction is a component that stores data through a remote procedure call (RPC), an asynchronous check (Async Check) can also be performed on the first storage component corresponding to the business processing instruction. The asynchronous check is used to check whether the data update in the corresponding storage component is successful.
[0116] For example, see Figure 8 , Figure 8Schematic diagram of an optional business transaction processing scenario provided by an embodiment of the present application. Figure 8 As shown, assuming that N is 4, the first storage component 1 is an image information database (DB), the first storage component 2 is a seed library, the first storage component 3 is a key value library (KV), and the first storage component 4 is a core database (COS). The seed library and the core database are not data-related components. The first storage component 1 corresponds to business processing instruction 1 (DB-do), and DB-do corresponds to business processing reverse instruction 1 (DB-undo); the first storage component 2 corresponds to business processing instruction 2 (Seed Store-do), and Seed Store-do corresponds to business processing reverse instruction 2 (Seed Store-undo); the first storage component 3 corresponds to business processing instruction 3 (KV-do), and KV-do corresponds to business processing reverse instruction 3 (KV-undo). At this time, the computer device can perform version detection initialization and perform version consistency detection on DB-do. If the version consistency detection of DB-do fails, it returns to perform version detection initialization. If the version consistency detection of DB-do is successful, DB-do is executed. If the execution of DB-do fails, the first business transaction is terminated; if the execution of DB-do succeeds, Seed Store-do is processed. When processing Seed Store-do, SeedStore-do can be executed. If the execution of Seed Store-do fails, DB-undo is executed. If the execution of DB-undo succeeds, the first business transaction is terminated; if the execution of Seed Store-do succeeds, KV-do is processed.
[0117] Further, when processing KV-do, the computer device can perform a version consistency check on KV-do. If the version consistency check on KV-do fails, Seed Store-undo and DB-undo are executed in sequence, and the version check initialization is returned. When the execution fails during the execution of Seed Store-undo and DB-undo, asynchronous compensation can be performed. If the version consistency check on KV-do is successful, KV-do is executed. If the execution of KV-do fails, Seed Store-undo and DB-undo are executed in sequence to terminate the first business transaction; if the execution of KV-do is successful, COS-do is processed. When processing COS-do, the computer device can execute the COS-do. If the execution of COS-do fails, KV-undo, Seed Store-undo and DB-undo are executed in sequence to terminate the first business transaction. If COS-do is executed successfully, it means that the processing of the first business transaction is completed.
[0118] For further information, see Fig. 9 , Fig. 9 This is a flow chart of a specific method for business processing provided by an embodiment of the present application. Fig. 9 As shown, the business processing process includes the following steps:
[0119] Step S901: obtain a first business transaction and generate second transaction version information of the first business transaction.
[0120] In an embodiment of the present application, a computer device can obtain a first business transaction, generate second transaction version information of the first business transaction, and the second transaction version information is a transaction version identifier of the first business transaction. Specifically, the computer device can obtain a generation timestamp of the first business transaction, and determine the generation timestamp as the second transaction version information of the first business transaction. Alternatively, the computer device can obtain a generation timestamp of the first business transaction, generate a version string, and combine the generation timestamp and the version string to form the second transaction version information of the first business transaction, wherein the version string can be a random string, etc. Alternatively, the computer device can obtain an adjacent historical transaction version identifier, perform self-increment processing on the adjacent historical transaction version identifier, and obtain the second transaction version information of the first business transaction; wherein the adjacent historical transaction version identifier refers to the transaction version identifier with the largest generation time among the currently generated transaction version identifiers. Alternatively, the computer device may obtain a generation timestamp of the first business transaction and M business transactions generated at the generation timestamp; the M business transactions include the first business transaction; M is a positive integer; based on the generation timestamp and the generation order of the M business transactions, transaction version information corresponding to the M business transactions is generated, and the transaction version information corresponding to the M business transactions includes the second transaction version information.
[0121] Step S902: split the first business transaction into N business processing instructions based on the N first storage components associated with the first business transaction.
[0122] In the embodiment of the present application, this process can be referred to Figure 4 The relevant description in step S401 will not be repeated here.
[0123] Step S903: Generate inverse business processing instructions corresponding to N business processing instructions.
[0124] In an embodiment of the present application, a computer device may generate business processing inverse instructions corresponding to the first N-1 business processing instructions among N business processing instructions. Specifically, the computer device may obtain instruction processing parameters respectively included in the first N-1 business processing instructions among the N business processing instructions, and obtain inverse processing parameters respectively corresponding to the first N-1 instruction processing parameters from the operation language of the first storage component respectively corresponding to the first N-1 business processing instructions. For example, if the instruction processing parameter included in business processing instruction 1 is Insert, and the operation language is SQL, then the inverse processing parameter corresponding to the business processing instruction 1 may be Delete, etc. Further, the computer device may generate business processing inverse instructions respectively corresponding to the first N-1 business processing instructions based on the operation languages respectively corresponding to the first N-1 first storage components, and the inverse processing parameters respectively corresponding to the first N-1 instruction processing parameters.
[0125] For example, see Fig.10 , Fig.10 is a schematic diagram of an instruction of a business transaction provided in an embodiment of the present application, such as Fig.10 As shown, business processing inverse instructions 1002 corresponding to N business processing instructions 1001 are generated, wherein the N business processing instructions 1001 may include business processing instructions 1 to business processing instructions N, and the business processing inverse instructions 1002 may include business processing inverse instructions corresponding to the first N-1 business processing instructions, such as business processing inverse instruction 1 corresponding to business processing instruction 1, business processing inverse instruction 2 corresponding to business processing instruction 2, ..., business processing inverse instruction N-1 corresponding to business processing instruction N-1. For example, when the business scenario is an image similarity detection scenario, you can refer to Fig.11 , Fig.11 Schematic diagram of an optional business transaction instruction provided by the application embodiment. Fig.11 As shown, the N business processing instructions 1101 may include business processing instructions for the information database, business processing instructions for the result seed library, business processing instructions for the seed information library, and business processing instructions for the original database; the N-1 business processing inverse instructions 1102 may include business processing inverse instructions for the information database, business processing inverse instructions for the result seed library, and business processing inverse instructions for the seed information library.
[0126] Step S904, obtaining the jth business processing instruction.
[0127] In the embodiment of the present application, the computer device may obtain the jth business processing instruction from N business processing instructions, where j is a positive integer less than or equal to N, and the initial value of j may be 1. At this time, the jth business processing instruction is a to-be-processed instruction.
[0128] Step S905: obtain the business version information associated with the first storage component corresponding to the j-th business processing instruction, and obtain the first transaction version information corresponding to the instruction to be processed in the first business transaction.
[0129] In the embodiment of the present application, this process can be referred to Figure 4 The relevant description in step S402 will not be repeated here.
[0130] Step S906: Detect whether the j-th service version information is the same as the first transaction version information.
[0131] In the embodiment of the present application, if the jth service version information is the same as the first transaction version information, step S907 is executed; if the jth service version information is different from the first transaction version information, step S911 is executed. Figure 4 The relevant description in step S403 will not be repeated here.
[0132] Step S907: If the j-th service version information is the same as the first transaction version information, execute the pending instruction.
[0133] In the embodiment of the present application, this process can be referred to Figure 4 The relevant description in step S404 will not be repeated here.
[0134] Step S908, detecting whether the j-th business processing instruction is executed successfully.
[0135] In the embodiment of the present application, the computer device can detect whether the jth business processing instruction is executed successfully. If the jth business processing instruction is executed successfully, step S909 is executed; if the jth business processing instruction fails to be executed, step S910 is executed. Figure 4 The relevant description in step S405 will not be repeated here.
[0136] Step S909: if the jth business processing instruction is executed successfully, the business version information of the jth business processing instruction is updated, j++.
[0137] In the embodiment of the present application, if the jth business processing instruction is executed successfully, the computer device can update the business version information of the jth business processing instruction. For details, see Figure 4 The relevant description of step S405 is not repeated here. Further, if the jth business processing instruction is the last business processing instruction, that is, j is N, the processing of the first business transaction is terminated; if the jth business processing instruction is not the last business processing instruction, that is, j is less than N, j is incremented, recorded as j++, and the process returns to step S904.
[0138] Step S910: If the execution of the j-th business processing instruction fails, then the business processing inverse instruction corresponding to the preceding instruction of the j-th business processing instruction is executed.
[0139] In the embodiment of the present application, this process can be referred to Figure 4 The relevant description in step S406 will not be repeated here. Fig.10 As shown in , assuming that the jth business processing instruction is business processing instruction 3, the pre-instruction of the jth business processing instruction includes business processing instruction 1 and business processing instruction 2, and the computer device can sequentially execute business processing inverse instruction 2 corresponding to business processing instruction 2, and business processing inverse instruction 1 corresponding to business processing instruction 1. Fig.11 As shown in , assuming that the jth business processing instruction is a business processing instruction for the seed information library, the computer device can sequentially execute the business processing inverse instruction for the result seed library and the business processing inverse instruction for the information database.
[0140] Step S911: If the j-th service version information is different from the first transaction version information, then execute the service processing inverse instruction corresponding to the preceding instruction of the j-th service processing instruction.
[0141] In an embodiment of the present application, if the j-th business version information is different from the first transaction version information, the computer device may execute the business processing inverse instruction corresponding to the preceding instruction of the j-th business processing instruction. Alternatively, if the business version information is different from the first transaction version information, the computer device may re-acquire the business version information associated with the first storage component corresponding to the instruction to be processed, until the number of times the business version information is re-acquired is greater than or equal to the version retry number threshold, or the re-acquired business version information is the same as the first transaction version information; if the number of times the business version information is re-acquired is greater than or equal to the version retry number threshold, the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is executed. Further, after the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is successfully executed, the computer device may end the processing process of the first business transaction, or may retry processing the first business transaction. Among them, when executing any business processing reverse instruction, the business version information of the first storage component corresponding to the business processing reverse instruction can also be rolled back. For example, after executing the business processing reverse instruction 1 corresponding to the business processing instruction 1, the business version information corresponding to the business processing reverse instruction 1 can be rolled back to the business version information before the execution of the business processing instruction 1.
[0142] Optionally, the computer device may deploy A service nodes and obtain node association interfaces corresponding to the A service nodes respectively; A is a positive integer. Data synchronization functions are deployed for the A service nodes respectively through the node association interfaces corresponding to the A service nodes respectively; a master service node is determined from the A service nodes, and when the first business transaction is processed through the master service node, the transaction processing status of the first business transaction is synchronized to the slave service node through the data synchronization function of the master service node; the slave service node is a service node other than the master service node among the A service nodes; the transaction processing status is used to indicate the status of the N first storage components during the first business transaction processing process.
[0143] Optionally, if an abnormality occurs in the main service node, a normally operating candidate service node is searched from the secondary service nodes. If a candidate service node is found, the main service node is re-determined from the candidate service nodes, and the first business transaction is continued to be processed through the re-determined main service node; if the candidate service node is not found, the transaction processing status of the first business transaction is stored, a node abnormality prompt message is sent to the management object, and when there is a normally operating first service node, the first business transaction is continued to be processed in the first service node through the transaction processing status of the first business transaction.
[0144] Optional, in the above Figure 4 and Fig. 9 In the embodiments of the present invention, when executing any data instruction, if the data instruction fails to execute, the data instruction is re-executed until the number of executions of the data instruction is greater than or equal to the instruction retry threshold, or the data instruction is successfully executed, and the instruction retry threshold is used to indicate the maximum number of executions for an instruction. Among them, the data instruction can be any of the above-mentioned business processing instructions or business processing inverse instructions. Optionally, when the number of executions of the data instruction is greater than or equal to the instruction retry threshold, the state of the first business transaction can be rolled back based on the data instruction, so that the states of the N first storage components are rolled back to before the processing of the first business transaction, and the first business transaction is terminated, or an instruction execution exception prompt message can be sent to the business object (i.e., the user) associated with the first business transaction, so that the business object detects and processes the data instruction for exception.
[0145] In an embodiment of the present application, a first business transaction is obtained, and based on N first storage components associated with the first business transaction, the first business transaction is split into N business processing instructions; N is a positive integer; each business processing instruction is used to update data of one of the N first storage components; the N business processing instructions include an instruction to be processed; business version information associated with the first storage component corresponding to the instruction to be processed is obtained, and first transaction version information corresponding to the instruction to be processed in the first business transaction is obtained; the first transaction version information is used to indicate the theoretical version of the first storage component corresponding to the instruction to be processed. If the business version information is the same as the first transaction version information, the instruction to be processed is executed; if the execution of the instruction to be processed fails, the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is executed; the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is used to roll back the status of the N first storage components to the status before processing the first business transaction; the preceding instruction of the instruction to be processed refers to the business processing instruction that is located before the instruction to be processed among the N business processing instructions. In the present application, business transaction splitting and multi-storage component version unification are introduced in the process of processing the first business transaction. Specifically, the first business transaction is split based on the N first storage components associated with the first business transaction to obtain a series of small independent operations (i.e., business processing instructions), and a compensation mechanism is defined for the business processing instructions, that is, the business processing inverse instructions corresponding to each business processing instruction. Therefore, when any business processing instruction fails to execute, the states of the N first storage components can be rolled back to a consistent state. In other words, for the same business transaction, it can be achieved that each first storage component is either updated based on the business transaction or not updated based on the business transaction, thereby achieving state synchronization of each first storage component and improving the accuracy of business processing. At the same time, based on the transaction version information of the business transaction and the business version information of each storage component, the state consistency of each storage component is guaranteed, thereby improving the accuracy of business processing and the data accuracy of the storage component.
[0146] For further information, see Fig.12 , Fig.12 Schematic diagram of a service processing device provided in an embodiment of the present application. The service processing device may be a computer program (including program code, etc.) running in a computer device, for example, the service processing device may be an application software; the device may be used to execute the corresponding steps in the method provided in an embodiment of the present application. Fig.12 As shown, the service processing device 1200 can be used for Figure 4 The computer device in the corresponding embodiment may specifically include: an instruction acquisition module 11 , a version acquisition module 12 , an instruction processing module 13 and a state rollback module 14 .
[0147] The instruction acquisition module 11 is used to acquire the first business transaction, and split the first business transaction into N business processing instructions based on the N first storage components associated with the first business transaction; N is a positive integer; each business processing instruction is used to update data of one of the N first storage components; the N business processing instructions include pending instructions;
[0148] The version acquisition module 12 is used to acquire the business version information associated with the first storage component corresponding to the instruction to be processed, and acquire the first transaction version information corresponding to the instruction to be processed in the first business transaction; the first transaction version information is used to indicate the theoretical version of the first storage component corresponding to the instruction to be processed;
[0149] An instruction processing module 13, configured to execute the instruction to be processed if the service version information is the same as the first transaction version information;
[0150] The status rollback module 14 is used to execute the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed if the execution of the instruction to be processed fails; the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is used to roll back the status of the N first storage components to the state before processing the first business transaction; the preceding instruction of the instruction to be processed refers to the business processing instruction among the N business processing instructions that is located before the instruction to be processed.
[0151] The device 1200 further includes:
[0152] The parameter acquisition module 15 is used to acquire instruction processing parameters respectively included in the first N-1 business processing instructions among the N business processing instructions, and acquire inverse processing parameters respectively corresponding to the first N-1 instruction processing parameters from the operation language of the first storage component respectively corresponding to the first N-1 business processing instructions;
[0153] The instruction generation module 16 is used to generate business processing inverse instructions corresponding to the first N-1 business processing instructions based on the operation languages corresponding to the first N-1 first storage components and the inverse processing parameters corresponding to the first N-1 instruction processing parameters.
[0154] The device 1200 further includes:
[0155] The data acquisition module 17 is used to acquire the generation timestamp of the first business transaction and M business transactions generated at the generation timestamp; the M business transactions include the first business transaction; M is a positive integer;
[0156] The version generation module 18 is used to generate transaction version information corresponding to the M business transactions respectively based on the generation timestamp and the generation order of the M business transactions.
[0157] The device 1200 further includes:
[0158] A relationship detection module 19, configured to detect a data association relationship between the N first storage components, and determine a first storage component having a data association relationship among the N first storage components as a data association component;
[0159] The version acquisition module 12 is further configured to execute a process of acquiring business version information associated with the first storage component corresponding to the instruction to be processed if the instruction to be processed is a data-related component;
[0160] The instruction execution module 20 is used to execute the instruction to be processed if the instruction to be processed is not a data-related component.
[0161] The device 1200 further includes:
[0162] The version reprocessing module 21 is configured to reacquire the business version information associated with the first storage component corresponding to the instruction to be processed if the business version information is different from the first transaction version information, until the number of times the business version information is reacquired is greater than or equal to a version retry number threshold, or the reacquired business version information is the same as the first transaction version information;
[0163] The state rollback module 14 is further configured to execute a business processing inverse instruction corresponding to a preceding instruction of the instruction to be processed if the number of times the business version information is re-acquired is greater than or equal to a version retry number threshold.
[0164] The device 1200 further includes:
[0165] A version determination module 22, configured to obtain second transaction version information corresponding to the first business transaction if the instruction to be processed is executed successfully;
[0166] The version determination module 22 is further configured to determine the second transaction version information as the business version information of the first storage component corresponding to the instruction to be processed.
[0167] The device 1200 further includes:
[0168] The service processing module 23 is used to deploy A service nodes and obtain node association interfaces corresponding to the A service nodes respectively; A is a positive integer;
[0169] The service processing module 23 is further used to deploy data synchronization functions for the A service nodes respectively through the node association interfaces respectively corresponding to the A service nodes;
[0170] The service processing module 23 is also used to determine the main service node from A service nodes. When processing the first business transaction through the main service node, the transaction processing status of the first business transaction is synchronized to the slave service node through the data synchronization function of the main service node; the slave service node is a service node other than the main service node among the A service nodes; the transaction processing status is used to indicate the status of N first storage components during the first business transaction processing.
[0171] The device 1200 further includes:
[0172] The exception handling module 24 is used to search for a candidate service node that is operating normally from the slave service nodes if an exception occurs in the master service node;
[0173] The exception handling module 24 is further configured to, if a candidate service node is found, redetermine a primary service node from the candidate service nodes, and continue to process the first business transaction through the redetermined primary service node;
[0174] The exception handling module 24 is also used to store the transaction processing status of the first business transaction if no candidate service node is found, send a node exception prompt message to the management object, and continue to process the first business transaction in the first service node through the transaction processing status of the first business transaction when there is a normally operating first service node.
[0175] When the first business transaction is split into N business processing instructions based on the N first storage components associated with the first business transaction, the instruction acquisition module 11 may be used to:
[0176] Obtain B storage components included in the business scenario to which the first business transaction belongs, and obtain N subtransactions included in the first business transaction; B is a positive integer greater than or equal to N;
[0177] From the B storage components, first storage components respectively associated with the N subtransactions are determined, and based on the N subtransactions and the first storage components associated with each subtransaction, business processing instructions respectively corresponding to the N subtransactions are generated.
[0178] Among them, B storage components include an information database, a result seed library, a seed information library and an original database; the information database includes seed data of business data and seed description information associated with the seed data; the result seed library includes transaction processing results of business transactions and business detection results of data detection services; the seed information library includes seed data and reasons for data entry; the original database includes business data; the device 1200 also includes:
[0179] The data detection module 25 is used to generate first seed data of first service data included in the first data detection service in response to the processing operation for the first data detection service;
[0180] The data detection module 25 is further used to search for the first seed data from the result seed library, and if the first seed data is found, determine the service detection result associated with the first seed data as the first service detection result for the first service data;
[0181] The data detection module 25 is also used to obtain the seed data included in the seed information library and the information database if the first seed data is not found, obtain the data similarity between the seed data and the first seed data, determine the seed data with data similarity greater than or equal to the data similarity threshold as the associated seed data of the first seed data, determine the data entry reason corresponding to the associated seed data as the first business detection result for the first business data, and add the first seed data and the first business detection result to the result seed library.
[0182] The state rollback module 14 may be used for:
[0183] If the instruction to be processed is a business processing instruction associated with the seed information library, when the execution of the instruction to be processed fails, the business data to be processed is obtained from the instruction to be processed, and the seed data to be processed of the business data to be processed is obtained;
[0184] Obtaining seed description information associated with the seed data to be processed from the information database, and adding the data entry reason in the seed description information associated with the seed data to be processed and the seed data to be processed to the seed information database;
[0185] If the addition to the seed information database fails, the process of executing the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is executed.
[0186] The state rollback module 14 may be used to:
[0187] If the first storage component associated with the pending instruction is a storage component for storing business data, when the execution of the pending instruction fails, the pending instruction is added to an asynchronous compensation queue for the first storage component associated with the pending instruction;
[0188] Scanning the asynchronous compensation queue through the asynchronous processing thread, when obtaining the instruction to be processed, adding the second business data associated with the instruction to be processed to the first storage component associated with the instruction to be processed;
[0189] If the first storage component associated with the instruction to be processed is not a storage component for storing business data, when the execution of the instruction to be processed fails, the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is executed.
[0190] An embodiment of the present application provides a business processing device, which can obtain a first business transaction, and split the first business transaction into N business processing instructions based on N first storage components associated with the first business transaction; N is a positive integer; each business processing instruction is used to update data of one of the N first storage components; the N business processing instructions include a pending instruction; business version information associated with the first storage component corresponding to the pending instruction is obtained, and first transaction version information corresponding to the pending instruction in the first business transaction is obtained; the first transaction version information is used to indicate the theoretical version of the first storage component corresponding to the pending instruction; if the business version information is the same as the first transaction version information, the pending instruction is executed; if the execution of the pending instruction fails, the business processing inverse instruction corresponding to the preceding instruction of the pending instruction is executed; the business processing inverse instruction corresponding to the preceding instruction of the pending instruction is used to roll back the status of the N first storage components to the status before processing the first business transaction; the preceding instruction of the pending instruction refers to the business processing instruction that is located before the pending instruction among the N business processing instructions. In the present application, business transaction splitting and multi-storage component version unification are introduced in the process of processing the first business transaction. Specifically, the first business transaction is split based on the N first storage components associated with the first business transaction to obtain a series of small independent operations (i.e., business processing instructions), and a compensation mechanism is defined for the business processing instructions, that is, the business processing inverse instructions corresponding to each business processing instruction. Therefore, when any business processing instruction fails to execute, the states of the N first storage components can be rolled back to a consistent state. In other words, for the same business transaction, it can be achieved that each first storage component is either updated based on the business transaction or not updated based on the business transaction, thereby achieving state synchronization of each first storage component and improving the accuracy of business processing. At the same time, based on the transaction version information of the business transaction and the business version information of each storage component, the state consistency of each storage component is guaranteed, thereby improving the accuracy of business processing and the data accuracy of the storage component.
[0191] See also Fig.13 , Fig.13 Schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig.13As shown, the computer device in the embodiment of the present application may include: one or more processors 1301, a memory 1302, and an input / output interface 1303. The processor 1301, the memory 1302, and the input / output interface 1303 are connected via a bus 1304. The memory 1302 is used to store a computer program, which includes program instructions, and the input / output interface 1303 is used to receive and output data, such as for data interaction between the computer device and the business device; the processor 1301 is used to execute the program instructions stored in the memory 1302.
[0192] The processor 1301 may perform the following operations:
[0193] Obtain a first business transaction, and split the first business transaction into N business processing instructions based on N first storage components associated with the first business transaction; N is a positive integer; each business processing instruction is used to update data of one of the N first storage components; the N business processing instructions include instructions to be processed;
[0194] Obtaining business version information associated with the first storage component corresponding to the instruction to be processed, and obtaining first transaction version information corresponding to the instruction to be processed in the first business transaction; the first transaction version information is used to indicate a theoretical version of the first storage component corresponding to the instruction to be processed;
[0195] If the service version information is the same as the first transaction version information, the pending instruction is executed;
[0196] If the execution of the instruction to be processed fails, the inverse business processing instruction corresponding to the preceding instruction of the instruction to be processed is executed; the inverse business processing instruction corresponding to the preceding instruction of the instruction to be processed is used to roll back the status of the N first storage components to the state before processing the first business transaction; the preceding instruction of the instruction to be processed refers to the business processing instruction among the N business processing instructions that is located before the instruction to be processed.
[0197] In some feasible implementations, the processor 1301 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0198] The memory 1302 may include a read-only memory and a random access memory, and provide instructions and data to the processor 1301 and the input / output interface 1303. A portion of the memory 1302 may also include a non-volatile random access memory. For example, the memory 1302 may also store information about the device type.
[0199] In a specific implementation, the computer device can execute the following operations through its built-in functional modules: Figure 4 For details on the implementation methods provided in each step, please refer to the Figure 4 The implementation methods provided in each step will not be repeated here.
[0200] The embodiment of the present application provides a computer device, including: a processor, an input / output interface, and a memory, wherein the processor obtains a computer program in the memory and executes the computer program. Figure 4The various steps of the method shown in are used to perform business processing operations. The embodiment of the present application realizes obtaining a first business transaction, and based on the N first storage components associated with the first business transaction, the first business transaction is split into N business processing instructions; N is a positive integer; each business processing instruction is used to update data of one of the N first storage components; the N business processing instructions include pending instructions; obtain the business version information associated with the first storage component corresponding to the pending instruction, and obtain the first transaction version information corresponding to the pending instruction in the first business transaction; the first transaction version information is used to indicate the theoretical version of the first storage component corresponding to the pending instruction; if the business version information is the same as the first transaction version information, the pending instruction is executed; if the execution of the pending instruction fails, the business processing inverse instruction corresponding to the preceding instruction of the pending instruction is executed, which is used to roll back the status of the N first storage components to the status before processing the first business transaction; the preceding instruction of the pending instruction refers to the business processing instruction that is located before the pending instruction among the N business processing instructions. In the present application, business transaction splitting and multi-storage component version unification are introduced in the process of processing the first business transaction. Specifically, the first business transaction is split based on the N first storage components associated with the first business transaction to obtain a series of small independent operations (i.e., business processing instructions), and a compensation mechanism is defined for the business processing instructions, that is, the business processing inverse instructions corresponding to each business processing instruction. Therefore, when any business processing instruction fails to execute, the states of the N first storage components can be rolled back to a consistent state. In other words, for the same business transaction, it can be achieved that each first storage component is either updated based on the business transaction or not updated based on the business transaction, thereby achieving state synchronization of each first storage component and improving the accuracy of business processing. At the same time, based on the transaction version information of the business transaction and the business version information of each storage component, the state consistency of each storage component is guaranteed, thereby improving the accuracy of business processing and the data accuracy of the storage component.
[0201] The present application also provides a computer-readable storage medium storing a computer program suitable for being loaded and executed by the processor. Figure 4 For details on the business processing methods provided in each step, please refer to the Figure 4The implementation methods provided in each step are not repeated here. In addition, the description of the beneficial effects of adopting the same method is not repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the computer program can be deployed to execute on one computer device, or on multiple computer devices located in one place, or on multiple computer devices distributed in multiple locations and interconnected by a communication network.
[0202] The computer-readable storage medium may be the business processing device provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the computer device. Further, the computer-readable storage medium may also include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0203] The present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes Figure 4The method provided in the various optional modes in the method realizes the introduction of business transaction splitting and multi-storage component version unification in the process of processing the first business transaction. Specifically, the first business transaction can be split based on the N first storage components associated with the first business transaction to obtain a series of small independent operations (i.e., business processing instructions), and a compensation mechanism is defined for the business processing instructions, that is, the business processing inverse instructions corresponding to each business processing instruction, so that when any business processing instruction fails to execute, the states of the N first storage components can be rolled back to a consistent state. In other words, for the same business transaction, it can be achieved that each first storage component is either all updated based on the business transaction, or none of them will be updated based on the business transaction, thereby realizing state synchronization of each first storage component and improving the accuracy of business processing; at the same time, based on the transaction version information of the business transaction and the business version information of each storage component, the state consistency of each storage component is guaranteed, thereby improving the accuracy of business processing and the data accuracy of the storage component.
[0204] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but optionally includes steps or modules that are not listed, or optionally includes other step units inherent to these processes, methods, devices, products, or equipment.
[0205] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0206] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in this description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0207] The method and related apparatus provided by the embodiment of the present application are described with reference to the method flow chart and / or structural diagram provided by the embodiment of the present application. Specifically, each process and / or box in the method flow chart and / or structural diagram, as well as the combination of the processes and / or boxes in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable business processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable business processing device generate instructions for implementing the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable business processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be loaded onto a computer or other programmable business processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A flow or multiple flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.
[0208] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.
[0209] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.
[0210] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A business processing method, characterized in that: The method comprises: Obtain a first business transaction, and split the first business transaction into N business processing instructions based on N first storage components associated with the first business transaction; N is a positive integer; each business processing instruction is used to update data of one of the N first storage components; and the N business processing instructions include instructions to be processed; Acquire business version information associated with the first storage component corresponding to the instruction to be processed, and acquire first transaction version information corresponding to the instruction to be processed in the first business transaction; the first transaction version information is used to indicate a theoretical version of the first storage component corresponding to the instruction to be processed; If the service version information is the same as the first transaction version information, executing the pending instruction; If the execution of the pending instruction fails, the inverse business processing instruction corresponding to the preceding instruction of the pending instruction is executed; the inverse business processing instruction corresponding to the preceding instruction of the pending instruction is used to roll back the status of the N first storage components to the state before processing the first business transaction; the preceding instruction of the pending instruction refers to the business processing instruction among the N business processing instructions that is located before the pending instruction.
2. The method according to claim 1, characterized in that The method further comprises: Obtain instruction processing parameters respectively included in the first N-1 business processing instructions of the N business processing instructions, and obtain inverse processing parameters respectively corresponding to the first N-1 instruction processing parameters from the operation language of the first storage component respectively corresponding to the first N-1 business processing instructions; Based on the operation languages respectively corresponding to the first N-1 first storage components and the inverse processing parameters respectively corresponding to the first N-1 instruction processing parameters, business processing inverse instructions respectively corresponding to the first N-1 business processing instructions are generated.
3. The method according to claim 1, characterized in that The method further comprises: Obtaining a generation timestamp of the first business transaction and M business transactions generated at the generation timestamp; the M business transactions include the first business transaction; M is a positive integer; Based on the generation timestamp and the generation order of the M business transactions, transaction version information corresponding to the M business transactions is generated.
4. The method according to claim 1, characterized in that: The method further comprises: Detecting the data association relationship between the N first storage components, and determining the first storage component with the data association relationship among the N first storage components as the data association component; If the instruction to be processed is the data-related component, executing the process of obtaining the business version information associated with the first storage component corresponding to the instruction to be processed; If the instruction to be processed is not the data-related component, the instruction to be processed is executed.
5. The method according to claim 1, characterized in that The method further comprises: If the business version information is different from the first transaction version information, re-acquire the business version information associated with the first storage component corresponding to the instruction to be processed, until the number of times the business version information is re-acquired is greater than or equal to the version retry number threshold, or the re-acquired business version information is the same as the first transaction version information; If the number of times the service version information is re-acquired is greater than or equal to the version retry number threshold, the service processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is executed.
6. The method according to claim 1, characterized in that The method further comprises: If the pending instruction is executed successfully, obtaining the second transaction version information corresponding to the first business transaction; The second transaction version information is determined as the business version information of the first storage component corresponding to the instruction to be processed.
7. The method according to claim 1, characterized in that The method further comprises: Deploy A service nodes, and obtain node association interfaces corresponding to the A service nodes respectively; A is a positive integer; Deploy data synchronization functions for the A service nodes respectively through the node association interfaces respectively corresponding to the A service nodes; A master service node is determined from the A service nodes. When the first business transaction is processed by the master service node, the transaction processing status of the first business transaction is synchronized to a slave service node through a data synchronization function of the master service node. The slave service node is a service node other than the master service node among the A service nodes. The transaction processing status is used to indicate the status of the N first storage components during the processing of the first business transaction.
8. The method according to claim 7, characterized in that The method further comprises: If the main service node is abnormal, searching for a candidate service node that is operating normally from the slave service nodes; If the candidate service node is found, re-determine the primary service node from the candidate service nodes, and continue to process the first business transaction through the re-determined primary service node; If the candidate service node is not found, the transaction processing status of the first business transaction is stored, a node abnormality prompt message is sent to the management object, and when there is a normally operating first service node, the first business transaction is continued to be processed in the first service node through the transaction processing status of the first business transaction.
9. The method according to claim 1, characterized in that: The step of splitting the first business transaction into N business processing instructions based on the N first storage components associated with the first business transaction includes: Acquire B storage components included in the business scenario to which the first business transaction belongs, and acquire N subtransactions included in the first business transaction; B is a positive integer greater than or equal to N; A first storage component associated with each of the N subtransactions is determined from the B storage components, and business processing instructions corresponding to each of the N subtransactions are generated based on the N subtransactions and the first storage component associated with each subtransaction.
10. The method according to claim 9, characterized in that The B storage components include an information database, a result seed library, a seed information library and an original database; the information database includes seed data of business data and seed description information associated with the seed data; the result seed library includes transaction processing results of business transactions and business detection results of data detection services; The seed information database includes the seed data and the reason for data entry; The original database includes the business data; the method further includes: In response to a processing operation for a first data detection service, generating first seed data of first service data included in the first data detection service; searching the first seed data from the result seed library, and if the first seed data is found, determining the service detection result associated with the first seed data as the first service detection result for the first service data; If the first seed data is not found, the seed data included in the seed information library and the information database is obtained, the data similarity between the seed data and the first seed data is obtained, the seed data whose data similarity is greater than or equal to the data similarity threshold is determined as the associated seed data of the first seed data, the data entry reason corresponding to the associated seed data is determined as the first business detection result for the first business data, and the first seed data and the first business detection result are added to the result seed library.
11. The method according to claim 10, characterized in that If the execution of the instruction to be processed fails, executing the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed includes: If the instruction to be processed is a business processing instruction associated with the seed information library, then when the execution of the instruction to be processed fails, obtaining the business data to be processed from the instruction to be processed and obtaining the seed data to be processed of the business data to be processed; Acquire the seed description information associated with the seed data to be processed from the information database, and add the data entry reason in the seed description information associated with the seed data to be processed and the seed data to be processed to the seed information database; If the addition to the seed information database fails, the process of executing the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is performed.
12. The method according to claim 1, characterized in that If the execution of the instruction to be processed fails, executing the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed includes: If the first storage component associated with the pending instruction is a storage component for storing business data, then when the execution of the pending instruction fails, the pending instruction is added to an asynchronous compensation queue for the first storage component associated with the pending instruction; Scanning the asynchronous compensation queue through an asynchronous processing thread, when obtaining the instruction to be processed, adding the second business data associated with the instruction to be processed to the first storage component associated with the instruction to be processed; If the first storage component associated with the instruction to be processed is not a storage component for storing business data, then when the execution of the instruction to be processed fails, the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is executed.
13. A service processing device, characterized in that: The device comprises: An instruction acquisition module, used to acquire a first business transaction, and split the first business transaction into N business processing instructions based on N first storage components associated with the first business transaction; N is a positive integer; each business processing instruction is used to update data of one of the N first storage components; the N business processing instructions include pending instructions; A version acquisition module, configured to acquire business version information associated with a first storage component corresponding to the instruction to be processed, and acquire first transaction version information corresponding to a predecessor transaction of the first business transaction; the predecessor transaction of the first business transaction refers to a transaction generated before the first business transaction; An instruction processing module, configured to execute the instruction to be processed if the service version information is the same as the first transaction version information; A state rollback module is used to execute the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed if the execution of the instruction to be processed fails; the business processing inverse instruction corresponding to the preceding instruction of the instruction to be processed is used to roll back the state of the N first storage components to the state before processing the first business transaction; the preceding instruction of the instruction to be processed refers to the business processing instruction among the N business processing instructions that is located before the instruction to be processed.
14. A computer device, characterized in that: Includes processor, memory, input and output interfaces; The processor is connected to the memory and the input / output interface respectively, wherein the input / output interface is used to receive and output data, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method described in any one of claims 1-12.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 12.
16. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 12 is implemented.
Citation Information
Cited By
Distributed service change configuration processing method and device, electronic equipment and program product
CN121711246A