Transaction execution method and device, electronic equipment and storage medium

By generating and saving execution commands in database transactions, the complexity and cost problems of distributed transactions in simple scenarios are solved, and transaction execution with high consistency and high success rate is achieved.

CN120256032APending Publication Date: 2025-07-04CHONGQING ANT CONSUMER FINANCE CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510315787.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

In the prior art, distributed transactions introduce complexity and cost in simple scenarios that affect system stability and reliability, and are difficult to ensure consistency and reduce failure rate.

Method used

By responding to transaction requests, determining transaction components and generating execution commands, saving them to database transactions, ensuring strong consistency and atomicity of transactions, and using proximity deployment to execute transactions to improve success rate.

Benefits of technology

It improves the success rate of transaction execution, reduces deployment costs, and provides efficient and precise transaction execution control in complex scenarios, ensuring high consistency and high success rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256032A_ABST
    Figure CN120256032A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a transaction execution method and device, electronic equipment and a storage medium, and the method comprises the steps: responding to a transaction request for a target transaction, and determining a transaction component required by the transaction request; generating an execution command of the transaction component based on the transaction type of the target transaction, and storing the execution command into a database transaction corresponding to the target transaction; the database transaction is used for storing related data of a target transaction; and executing the target transaction according to the execution command to obtain an execution result of the target transaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer technology, and particularly to a transaction execution method, apparatus, electronic device, and storage medium. Background Art

[0002] In the prior art, the time consumption of some transaction processing procedures is relatively long, and usually each step must be successful to complete the execution of the entire transaction. Since the call chain of these transactions is relatively long and involves the collaboration of multiple systems or services, the failure of any link will lead to the failure or error of the entire transaction, thus affecting the overall stability and reliability of the system. In addition, the integration cost of distributed transactions is relatively high, and it is necessary to coordinate among multiple services to handle problems such as node failures and network delays. In complex scenarios of multi-party collaboration, distributed transactions have important application values because they can ensure data consistency and transaction integrity across services and systems. However, for some simple transaction scenarios, the introduction of distributed transactions not only seems too complex but also brings unnecessary performance overhead and maintenance costs.

[0003] Although distributed transactions play an important role in complex collaboration scenarios, their complexity and costs are often not worth the investment in simple scenarios. How to reduce the complexity and failure rate of transaction execution while ensuring consistency has become an urgent problem in the current technology. Summary of the Invention

[0004] The main purpose of this specification is to provide a transaction execution method, apparatus, electronic device, and storage medium, aiming to improve the consistency of transaction execution and thus increase the success rate of transaction completion. The technical solutions are as follows:

[0005] In a first aspect, an embodiment of this specification provides a transaction execution method, including:

[0006] In response to a transaction request for a target transaction, determine the transaction components required by the transaction request;

[0007] Generate an execution command for the transaction components based on the transaction type of the target transaction, and save the execution command to the database transaction corresponding to the target transaction; the database transaction is used to store data related to the target transaction;

[0008] Execute the target transaction according to the execution command to obtain the execution result of the target transaction.

[0009] In a second aspect, an embodiment of this specification provides a transaction execution apparatus, including:

[0010] A determination unit, configured to determine the transaction components required by the transaction request in response to a transaction request for a target transaction;

[0011] A generation unit, configured to generate an execution command for the transaction component based on the transaction type of the target transaction, and save the execution command into the database transaction corresponding to the target transaction; the database transaction is used to store target transaction-related data;

[0012] An execution unit, configured to execute the target transaction according to the execution command to obtain an execution result of the target transaction, and update the transaction execution status according to the execution process of the target transaction.

[0013] In a third aspect, an embodiment of this specification provides an electronic device, where the device includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the computer program is executed by the processor, the steps of the foregoing method are implemented.

[0014] In a fourth aspect, an embodiment of this specification provides a storage medium, where a computer program is stored on the storage medium, and when the computer program is executed by a processor, the steps of the foregoing method are implemented.

[0015] In a fifth aspect, an embodiment of this specification provides a computer program product, including: a computer program, when the computer program is executed by a processor of an electronic device, enabling the processor to at least implement the method described in the first aspect.

[0016] In the embodiments of this specification, by responding to a transaction request for a target transaction, determining a transaction component required by the transaction request, performing a command-based abstraction on the transaction, generating an execution command for the transaction component locally based on the transaction type of the target transaction, and saving the execution command into the database transaction corresponding to the target transaction through proximal deployment, the strong consistency and atomicity with the transaction are ensured. Then, the stored execution command is called to execute the target transaction, so as to obtain an execution result of the target transaction. By adopting this method, the successful saving of the execution command is ensured, and the execution success rate of the target transaction is improved. Description of the Drawings

[0017] To more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of this specification, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0018] Figure 1 It is a schematic flowchart of a transaction execution method provided by an embodiment of this specification;

[0019] Figure 2It is a schematic flowchart of a transaction execution method provided by an embodiment of this specification;

[0020] Figure 3 It is a schematic flowchart of a transaction execution method provided by an embodiment of this specification;

[0021] Figure 4 It is a schematic flowchart of a transaction execution method provided by an embodiment of this specification;

[0022] Figure 5 It is an example schematic diagram of a transaction execution method provided by an embodiment of this specification;

[0023] Figure 6 It is an example schematic diagram of a transaction execution method provided by an embodiment of this specification;

[0024] Figure 7 It is a schematic architecture diagram of a transaction execution method provided by an embodiment of this specification;

[0025] Figure 8 It is a schematic structural diagram of a transaction execution device provided by an embodiment of this specification;

[0026] Figure 9 It is a schematic structural diagram of an electronic device provided by an embodiment of this specification. Specific embodiments

[0027] Next, the technical solutions in the embodiments of this specification will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of this specification. Obviously, the described embodiments are only a part of the embodiments of this specification, rather than all the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this specification.

[0028] In the related art, for the processing of transactions, a distributed system can be used. Please refer to Figure 1 , Figure 1 This is a schematic flowchart of a transaction execution method provided by an embodiment of this specification. In a distributed system, the message producer can be Server 1. After Server 1 produces an instruction, it sends it to the message middleware. After the message consumers (such as Servers 2-4) successfully process the instruction, they can inform the producer through a feedback mechanism (such as returning a result or sending a confirmation message). However, after introducing the message middleware, the system architecture becomes more complex, and this remote method cannot guarantee whether the command is executed. At the same time, developers need to additionally handle issues such as the configuration, monitoring, and troubleshooting of the message queue, and it is difficult to ensure the ultimate consistency of transaction processing.

[0029] Based on the above problems, an embodiment of this specification provides a transaction execution method. Please also refer to Figure 2 , which is a schematic flowchart of a transaction execution method provided by an embodiment of this specification. This transaction execution method can be applied to a server. After receiving a transaction request sent by a terminal, the server determines the transaction components required for the target transaction. The transaction components are used to specifically implement the transaction process. The server generates an execution command for the target transaction based on the transaction request, simplifies the transaction operations into a series of clear commands, and then saves the execution command in the database of the server, specifically in the database transaction corresponding to the target transaction in the database. A transaction is a concept used by a database management system (DBMS) to handle a set of operations (such as insert, update, delete) as a single unit. Each transaction is either fully executed or not executed at all, which can avoid data inconsistency in the intermediate state. By storing the commands in the database transaction, the consistency and reliability of the entire transaction process can be ensured. Then, consume the commands generated locally to implement the target transaction.

[0030] It can be understood that the transaction execution device provided in the embodiments of this specification can be a terminal device such as a mobile phone, a computer, a tablet computer, a smart watch, or a vehicle-mounted device, or can also be a module in the terminal device for implementing the transaction execution method.

[0031] The following will specifically describe the transaction execution method provided in this specification with reference to specific embodiments.

[0032] Please refer to Figure 3 , which is a schematic flowchart of a transaction execution method provided by an embodiment of this specification. As Figure 3 shown, the method of the embodiment of this specification may include the following steps S102 - S106.

[0033] S102, in response to a transaction request for a target transaction, determine the transaction components required by the transaction request;

[0034] In an embodiment of this specification, the transaction request is a request sent by an external system or a user, representing a desired transaction operation. The target transaction is the currently desired transaction, which can be any transaction that needs to ensure consistency, such as a payment transaction, a signing transaction, etc. This request will contain basic information about the target transaction, such as the transaction type (e.g., signing, payment, etc.), the time of the request, the parties involved, the data involved, etc.

[0035] Depending on the type and complexity of the transaction, a transaction may involve multiple links and steps, which need to be collaborated by different transaction components. That is, completing a transaction usually involves multiple steps (processes), so multiple components are required to assist in completion. Determine the transaction components required to complete the target transaction according to the received transaction request. A transaction component can be understood as an independent module that performs a specific task and is responsible for completing a specific function in the transaction. Each transaction component is independent of other components and can be dynamically loaded and called as needed. For example, the target transaction is signing a contract. To complete the signing, transaction processes such as real-name online verification, empirical OCR, contract generation, and contract signature and seal are required. Each different transaction process can correspond to a transaction component. For example, the real-name online verification component: used to authenticate the user's identity and ensure the legality of the user's identity. Multiple transaction processes can also correspond to one transaction component.

[0036] Optionally, each transaction component can be packaged into different command types. For example, the empirical OCR component is command type 1; multiple transaction components can also be packaged into one command type. For example, the contract generation component and the contract signature and seal component are command type 2. When specifically executing the command, it is implemented by the consumer corresponding to each command type. The role of the consumer is to execute the corresponding transaction operation according to the specific command type.

[0037] S104, generate an execution command for the transaction component based on the transaction type of the target transaction, and save the execution command to the database transaction corresponding to the target transaction;

[0038] In an embodiment of this specification, after determining the required transaction components, it is also necessary to ensure that the components can work together. Since different types of transactions may involve different transaction rules, processing methods, and execution orders, after determining the transaction components, generate execution commands for each transaction component according to the transaction type of the target transaction. By judging the transaction type, the system can organize these steps into a sequential process to determine the execution time of the transaction components. It can be understood that the execution order of different transaction types is not fixed, and the system needs to adjust the execution order according to actual needs. For example, in some transactions, certain steps must be completed first, while other steps need to wait for the completion of the pre-task before starting to execute. Therefore, the system must reasonably arrange the execution order according to the dependency relationship and priority of each transaction component.

[0039] The generated execution command specifies the specific operations of the transaction component. After generating the execution command, it is stored in the database transaction. This database transaction is also used to store data related to the target transaction, such as cache data related to the transaction (such as user session information, temporary calculation results, etc.), user data (such as user information, account balance, etc.), and basic information of the order (such as goods, quantity, status, etc.). According to the transaction mechanism of the database transaction, multiple asynchronous execution commands and a requisition form are saved when initiating the target transaction, and the execution commands are saved to the command table only when the database transaction is successfully committed.

[0040] S106, execute the target transaction according to the execution command to obtain the execution result of the target transaction.

[0041] In one embodiment of this specification, after the execution command is stored in the database transaction corresponding to the target transaction, the command can be immediately pushed into the thread pool for immediate execution, or it can be selected to be pushed into the thread pool for execution after being polled and queried through the scheduled task framework. Which command consumption method to choose depends on the needs of the transaction. After each execution command is executed, the execution result of the target transaction is obtained.

[0042] Suppose the target transaction is a process of a user placing an order and making a payment: The command table in the database records the execution instructions required to complete the "place an order and make a payment" transaction this time, such as the verification of the buyer's bank deduction, transfer, and the verification of the seller's bank receipt. At the same time as generating the execution instructions, an order table and a user account table can be generated and stored in the database together. The order table stores the basic information of the order (goods, quantity, status, etc.), and the user account table stores the balance information of the user. In the transaction, the system will ensure that after the user's payment is successful, the order status is updated to "paid", and at the same time the user balance is reduced. If any part of the operation fails (such as payment failure), the transaction will roll back to ensure that the status of the order and the account will not be inconsistent.

[0043] In the embodiment of this specification, by responding to a transaction request for a target transaction, determining the transaction components required by the transaction request, generating execution commands for the transaction components locally based on the transaction type of the target transaction, and saving the execution commands to the database transaction corresponding to the target transaction through proximal deployment, the strong consistency and atomicity of the transaction are ensured. Then, the stored execution commands are called from the database to execute the target transaction to obtain the execution result of the target transaction. Using this method ensures the successful saving of the execution commands, improves the execution success rate of the target transaction, and has a low deployment cost.

[0044] Please refer to Figure 4 , which provides a schematic flowchart of a transaction execution method for the embodiment of this specification. As Figure 4As shown, the method according to the embodiments of this specification may include the following steps S202 - S216.

[0045] S202, in response to a transaction request for a target transaction, obtain the transaction type corresponding to the transaction request;

[0046] In one embodiment of this specification, the transaction request may carry the name or identifier of the target transaction, so that the transaction type of the target transaction can be determined according to the name or identifier, or the transaction type of the target transaction may be directly carried in the transaction request.

[0047] S204, determine the transaction components required for the transaction request based on the transaction type of the target transaction;

[0048] In one embodiment of this specification, the transaction components required for the transaction request are determined according to the transaction type of the target transaction. For example, if the transaction type is a payment transaction, it may involve processes such as payment confirmation, account verification, payment request, and payment receipt. The required transaction components may be account and identity verification components, payment processing components, and transaction management and logging components. The transaction components corresponding to different transaction types can be pre-written as data files and stored in a database.

[0049] S206, determine the execution order of the transaction components based on the transaction type of the target transaction;

[0050] In one embodiment of this specification, according to the transaction type, the execution order of the transaction components can also be determined. For different transaction types, the required transaction components and the execution order between the transaction components can be saved to ensure the accurate execution of the target transaction. Please refer to Figure 5 , which is an example schematic diagram of the transaction execution method provided by the embodiments of this specification. Taking the payment transaction as an example, first call the account and identity verification component to verify the user information, then call the payment processing component to construct and send a payment request to the payment gateway according to the payment information, and wait for the payment receipt. At the same time, the transaction management and logging component records the relevant information of the payment request (including the user, amount, request time, etc.), listens for the receipt from the payment gateway, records the result of payment success or failure, updates the order status, processes the payment receipt, updates the payment status, and records detailed logs.

[0051] S208, generate an execution command for the transaction components based on the execution order;

[0052] In one embodiment of this specification, execution commands for each transaction component are generated according to the determined execution order, where the generated execution commands can be asynchronous execution commands. This componentization and sequential invocation ensure the convenience and smoothness of the transaction execution process. The execution commands may include the content to be executed by each transaction component, the execution order (time), and the execution conditions (such as being required to execute after the previous transaction component has completed execution).

[0053] Optionally, in one embodiment of this specification, generating the execution commands for the transaction components based on the execution order includes:

[0054] S2082, obtaining the preset scheduling policies configured for each of the transaction components;

[0055] In one embodiment of this specification, the preset scheduling policy is a pre-configured operation and maintenance / scheduling policy, and this preset scheduling policy can be a policy customized by operation and maintenance personnel or a default configured policy. For example, the number of processes used for the operation of different transaction components, the scheduling mode (such as asynchronous immediate execution, scheduled execution by time), the number of retry attempts, etc. can be specified in the scheduling policy.

[0056] S2084, generating the execution commands for the transaction components based on the preset scheduling policy and the execution order.

[0057] In one embodiment of the present specification, execution commands for transaction components are generated according to a preset scheduling policy and execution order. The method based on the preset scheduling policy can provide a more intelligent, flexible, and reliable task scheduling solution. Through the scheduling policy, operation and maintenance personnel can reasonably allocate the number of processes and resources according to the resource requirements of transaction components (such as CPU, memory, network, etc.). For example, for transaction components with high resource consumption, more processes or higher priorities can be configured to avoid resource contention during system busy periods and improve the overall system performance. In addition, by customizing the scheduling policy, priorities can be set for different transaction components. For example, tasks with higher priorities can be arranged to be executed first when resources are sufficient, while tasks with lower priorities can be postponed when resources are scarce, thus optimizing the efficiency of task completion. During operation, the scheduling policy can be adjusted in real time according to the system load or transaction execution situation. For example, during task execution, the number of concurrent executions can be adjusted in real time, or the retry times or execution priorities can be immediately adjusted after a certain transaction fails. Through the preset scheduling policy, a more complex fault tolerance mechanism can be defined. For example, when a task fails, a strategy of automatic fallback or rollback can be selected according to the situation to ensure that the system can recover to a stable state when an exception occurs. Further, through the preset scheduling policy, each transaction component can be instructed to record and monitor the execution situation, helping operation and maintenance personnel to discover problems in time and make adjustments. For example, record the execution time, failure times, etc. of the transaction, which is convenient for later analysis and optimization.

[0058] S210, obtain the identification information of the target transaction;

[0059] In one embodiment of the present specification, a unique identifier can be assigned to different target transactions. When the target transaction is obtained, the identification information of the target transaction is obtained to determine the corresponding database transaction. Specifically, each transaction will have a unique transaction ID to avoid conflicts between different transactions. The database management system (DBMS) uses the transaction ID to track the operations of each transaction on the database, including data addition, deletion, modification, etc. The transaction ID will be recorded in the transaction log to help the database recover and roll back transactions. During the execution of the transaction, the DBMS will allocate the necessary system resources (such as memory, disk space, etc.) and ensure that these resources are only associated with the transaction ID.

[0060] S212, save the execution command to the database transaction corresponding to the target transaction based on the identification information;

[0061] In one embodiment of this specification, in a database, each transaction should have a unique identifier (transaction ID). When saving an execution command, the execution command is associated with the transaction ID, that is, the execution command is saved to the storage location corresponding to the identifier information, so that all transaction data of the target transaction are stored together. To store the execution command, a command table can be established in the database to store the transaction ID corresponding to the command, the actual executed command, the time when the command is saved, the execution status of the command, the return result, etc.

[0062] S214. Obtain the execution command from the database transaction, and call the corresponding transaction component interface according to the execution command to execute the sub-target transaction of the target transaction, and obtain the sub-execution results of each sub-target transaction;

[0063] Specifically, after the command is produced and the database transaction is successfully submitted, all commands associated with the identifier information of the target transaction can be obtained by querying the command table in the database transaction. According to these execution commands, the corresponding transaction component interfaces are called to execute the relevant sub-target transactions. The transaction component interface is usually an API or function provided by a system. The execution of each sub-transaction usually returns a result, which may be successful, failed, or contain other detailed information. These results can be saved to the database.

[0064] It should be noted that when executing the target transaction, the database uses atomicity to ensure that all operations of the transaction are either all executed successfully or completely revoked. In a transaction, any failure will cause the transaction to roll back, thus avoiding inconsistencies caused by partial commits.

[0065] Optionally, in one embodiment of this specification, the obtaining the execution command from the database transaction and calling the corresponding transaction component interface according to the execution command to execute the sub-target transaction of the target transaction includes:

[0066] S2142. If the scheduling mode of the execution command is asynchronous immediate execution, obtain the execution command from the local database, call the corresponding transaction component interface according to the execution command to execute the sub-target transaction of the target transaction, and determine that the execution command is in the processing status;

[0067] Specifically, the command consumption provides two standard strategies (scheduling modes): asynchronous immediate execution and scheduled execution on time. If the scheduling mode of the execution command is asynchronous immediate execution, the corresponding transaction component interface is directly called, and the task is submitted to the thread pool to start execution. Further, the status of the execution command can be recorded as being in processing. By recording the status of the execution command, it is convenient for the execution system to monitor the execution situation of the execution command in real time. Please refer to Figure 6, which is an example schematic diagram of the transaction execution method provided by the embodiments of this specification. After the production execution command is issued, if the scheduling mode of the execution command is the immediate execution mode, the status of the command is determined to be the processing status (PROCESSING). If the scheduling mode of the execution command is the timed scheduling mode, the status of the command is determined to be the initialization status (INIT). After the timed time arrives, the execution command in the timed scheduling mode is retrieved, and its status is changed from the initialization status to the processing status. In the processing status, if the number of retries for command consumption failure does not reach the upper limit, it is changed to the initialization status and waits for the next retry process of retrieval. If the command has been in the execution status for a long time and exceeds a certain duration, it can also be reset to the initialization status. In addition, in the processing status, if the command starts to be consumed and the command consumption is successful, the command will be cleared or backed up and become the cleared status or the backed-up status; if the command starts to be consumed but is in the HOLD status, it may be postponed in the HOLD status and needs to wait for the opportunity to execute. If the number of retries for consuming the command reaches the upper limit, the execution command becomes the status of reaching the upper limit of retry times (EXECUTION_TIMES_LIMIT); if the command consumption fails, it becomes the processing exception (ERROR) status; if an unexpected exception occurs during the command consumption, the status of the command is determined to be the unexpected exception (EXCEPTION) status. It can be understood that Figure 6 only some possible statuses of the execution command are shown in , and the type of the status of the execution command can also be increased or decreased according to actual requirements.

[0068] S2144, if the scheduling mode of the execution command is the on-time scheduling execution, determine that the execution command is in the initialization status. When the timed time of the execution command arrives, transfer to the step of obtaining the execution command from the local database, calling the corresponding transaction component interface according to the execution command to execute the sub-goal transaction of the target transaction, and determining that the execution command is in the processing status;

[0069] Specifically, if the scheduling mode of the execution command is the on-time scheduling execution, it indicates that the execution command needs to be executed at a specific time. After the timed time of the execution command arrives, the command is obtained from the command table and executed. For example, a timed task framework can be generated, and the timed task framework will scan or query the command table at the set time interval, and then submit the queried tasks to the thread pool, and the threads in the thread pool will execute these tasks concurrently.

[0070] S2146, if there is a sub-goal transaction with a sub-execution result of execution failure, regenerate the updated execution command for the sub-goal transaction according to the preset scheduling policy, and call the corresponding transaction component interface according to the updated execution command to execute the sub-goal transaction.

[0071] Specifically, after executing a command, if there are sub-target transactions with sub-execution results of execution failure, the update execution command for the sub-target transactions can be regenerated according to a preset scheduling policy. The update execution command can include the time for the sub-target transactions to be re-executed, the number of threads allocated during re-execution, and so on. In addition, during the process of consuming commands, intelligent algorithms can also automatically adjust the number of consumed commands, the scheduling policy, whether to limit the flow, core metrics of the thread pool, etc. At the same time, it is also possible to monitor the backlog situation of commands, the production situation, consumption exception situations, consumption capabilities, dynamic retries, etc.

[0072] S216. Determine the execution result of the target transaction based on the sub-execution result.

[0073] In an embodiment of the present specification, the execution result of the target transaction is determined according to the sub-execution results of each sub-target transaction. For example, each sub-target transaction can be marked as "success" or "failure". The execution result of the target transaction can be merged according to the status of the sub-target transactions. If all sub-target transactions are executed successfully, the target transaction is regarded as successful. If any sub-target transaction fails to execute, the target transaction is also regarded as failed.

[0074] Please refer to Figure 7 , Figure 7 which is a schematic architecture diagram of a transaction execution method provided by an embodiment of the present specification. An embodiment of the present specification provides a transaction execution system, which may include a timed task component, a transaction application process, and a database. The timed task component is used to poll whether there are commands to be executed. The transaction application process is used to receive transaction requests and execute target transactions according to the transaction requests. The database is used to store the data required by the transaction application process. Multiple command types and their corresponding (command) consumers can be pre-stored in the transaction application process. Different command types are different transaction components. The transaction application process can include two aspects of capabilities. One part is the basic core capabilities, which can produce commands, create (register) consumers, consume commands, initiate immediate consumption, create new command types, and create new consumers. The other part is intelligent operation and maintenance and emergency capabilities, that is, by pre-configuring intelligent algorithms and scheduling policies in the process, it is possible to achieve dynamic switching of consumption methods (scheduling modes), dynamic flow limiting, dynamic regulation of consumption rates, and execution exception monitoring.

[0075] In the embodiments of this specification, by responding to a transaction request for a target transaction, obtaining the transaction type corresponding to the transaction request, determining the transaction components required for the transaction request based on the transaction type of the target transaction, dynamically determining the execution order of the transaction components based on the transaction type of the target transaction, and generating a corresponding execution command, this method can adjust the transaction execution order more precisely, flexibly meet the requirements of different transactions, and thus improve the efficiency and pertinence of the execution process. In addition, obtaining the identification information of the target transaction, saving the execution command to the database transaction corresponding to the target transaction based on the identification information, ensuring that the status of the transaction can be tracked and restored, providing higher transaction traceability and security. After that, obtaining the execution command from the database transaction and calling the corresponding transaction component interface according to the execution command to execute the sub-target transaction of the target transaction, obtaining the sub-execution results of each sub-target transaction, and determining the execution result of the target transaction based on the sub-execution results, can more precisely feedback and adjust the execution result of the target transaction according to the execution situation of the sub-tasks. Provide efficient and precise transaction execution control in more complex transaction scenarios, ensuring high consistency and high success rate.

[0076] The following will be combined with the attached Figure 8 to introduce the transaction execution device provided in the embodiments of this specification in detail. It should be noted that the transaction execution device in the attached Figure 8 is used to execute the method of the embodiments shown in this specification Figures 2 - 7 . For the sake of convenience of description, only the parts related to the embodiments of this specification are shown. For the specific technical details not disclosed, please refer to the embodiments shown in this specification Figures 2 - 7 .

[0077] Please refer to Figure 8 , which shows the structural schematic diagram of the transaction execution device provided by an exemplary embodiment of this specification. The transaction execution device can be implemented as all or part of the device through software, hardware, or a combination of both. The device 1 includes a determination unit 11, a generation unit 12, and an execution unit 13.

[0078] The determination unit 11 is configured to determine the transaction components required for the transaction request in response to a transaction request for a target transaction;

[0079] The generation unit 12 is configured to generate an execution command for the transaction component based on the transaction type of the target transaction, and save the execution command to the database transaction corresponding to the target transaction; the database transaction is used to store target transaction-related data;

[0080] The execution unit 13 is configured to execute the target transaction according to the execution command to obtain the execution result of the target transaction, and update the transaction execution status according to the execution process of the target transaction.

[0081] Optionally, the determining unit 11 is specifically configured to, in response to a transaction request for a target transaction, obtain the transaction type corresponding to the transaction request;

[0082] Determine the transaction components required by the transaction request based on the transaction type of the target transaction.

[0083] Optionally, the generating unit 12 is specifically configured to determine the execution order of the transaction components based on the transaction type of the target transaction;

[0084] Generate an execution command for the transaction components based on the execution order.

[0085] Optionally, the generating unit 12 is specifically configured to obtain a preset scheduling policy configured for each of the transaction components;

[0086] Generate an execution command for the transaction components based on the preset scheduling policy and the execution order.

[0087] Optionally, the generating unit 12 is specifically configured to obtain the identification information of the target transaction;

[0088] Save the execution command to the database transaction corresponding to the target transaction based on the identification information.

[0089] Optionally, the executing unit 13 is specifically configured to obtain the execution command from the database transaction, and call the corresponding transaction component interface according to the execution command to execute the sub-target transactions of the target transaction, and obtain the sub-execution results of each of the sub-target transactions;

[0090] Determine the execution result of the target transaction based on the sub-execution results.

[0091] Optionally, the executing unit 13 is specifically configured to, if the scheduling mode of the execution command is asynchronous immediate execution, obtain the execution command from the local database, call the corresponding transaction component interface according to the execution command to execute the sub-target transactions of the target transaction, and determine that the execution command is in the processing state;

[0092] If the scheduling mode of the execution command is scheduled execution on time, determine that the execution command is in the initialization state, and when the scheduled time of the execution command arrives, transfer to the step of obtaining the execution command from the local database, calling the corresponding transaction component interface according to the execution command to execute the sub-target transactions of the target transaction, and determining that the execution command is in the processing state.

[0093] Optionally, the execution unit 13 is further configured to, if there is a sub-goal transaction with a sub-execution result of execution failure, regenerate an update execution command for the sub-goal transaction according to a preset scheduling policy, and call a corresponding transaction component interface according to the update execution command to execute the sub-goal transaction.

[0094] It should be noted that when the transaction execution device provided in the above embodiment executes the transaction execution method, only the above division of each functional module is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the transaction execution device provided in the above embodiment and the transaction execution method embodiment belong to the same concept, and the implementation process is shown in detail in the method embodiment, which will not be repeated here.

[0095] The serial numbers of the embodiments in this specification are only for description and do not represent the advantages and disadvantages of the embodiments. In some cases, the actions or steps recorded in the claims can be executed in a different order from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In certain embodiments, multi-tasking and parallel processing are also possible or may be advantageous.

[0096] The embodiments of this specification also provide a storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the transaction execution method in the above Figures 2 - 7 shown embodiment. The specific execution process can refer to Figures 2 - 7 the specific description in the shown embodiment, which will not be repeated here.

[0097] Please refer to Figure 9 , which shows a schematic structural diagram of an electronic device provided by an exemplary embodiment of this specification. The electronic device in this specification may include one or more of the following components: a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, the memory 120, the input device 130, and the output device 140 may be connected through the bus 150.

[0098] The processor 110 may include one or more processing cores. The processor 110 connects various parts within the entire electronic device through various interfaces and circuits. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and by invoking data stored in the memory 120, it performs various functions of the terminal 100 and processes data. Optionally, the processor 110 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 110 may integrate a combination of one or several of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interfaces, and application programs, etc.; the GPU is responsible for rendering and drawing display content; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110 and may be implemented separately through a communication chip.

[0099] The memory 120 may include random access memory (RAM) and may also include read-only memory (ROM). Optionally, the memory 120 includes a non-transitory computer-readable storage medium. The memory 120 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing the operating system, instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The operating system may be the Android system, including a system developed based on the Android system in depth, the IOS system developed by Apple Inc., including a system developed based on the IOS system in depth, or other systems.

[0100] The memory 120 can be divided into an operating system space and a user space. The operating system runs in the operating system space, and native and third-party applications run in the user space. In order to ensure that different third-party applications can achieve good operating results, the operating system allocates corresponding system resources to different third-party applications. However, the requirements for system resources in different application scenarios in the same third-party application are also different. For example, in the local resource loading scenario, the third-party application has higher requirements for disk reading speed; in the animation rendering scenario, the third-party application has higher requirements for GPU performance. The operating system and third-party applications are independent of each other, and the operating system often cannot perceive the current application scenario of the third-party application in a timely manner, resulting in the operating system being unable to perform targeted system resource adaptation according to the specific application scenario of the third-party application.

[0101] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to open up data communication between third-party applications and the operating system so that the operating system can obtain the current scenario information of third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.

[0102] The input device 130 is used to receive input commands or data, and includes but is not limited to a keyboard, a mouse, a camera, a microphone, or a touch device. The output device 140 is used to output commands or data, and includes but is not limited to a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined, and the input device 130 and the output device 140 are touch screen displays.

[0103] The touch display screen can be designed as a full screen, a curved screen or a special-shaped screen. The touch display screen can also be designed as a combination of a full screen and a curved screen, or a combination of a special-shaped screen and a curved screen, which is not limited in the embodiments of this specification.

[0104] In addition, those skilled in the art can understand that the structure of the electronic device shown in the above drawings does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown, or combine certain components, or arrange the components differently. For example, the electronic device also includes components such as a radio frequency circuit, an input unit, a sensor, an audio circuit, a WiFi module, a power supply, and a Bluetooth module, which will not be described in detail here.

[0105] exist Figure 9 In the electronic device shown, the processor 110 may be used to call a computer application stored in the memory 120 and specifically perform the following operations:

[0106] In response to a transaction request for a target transaction, determining a transaction component required by the transaction request;

[0107] Generate an execution command for the transaction component based on the transaction type of the target transaction, and save the execution command to the database transaction corresponding to the target transaction; the database transaction is used to store target transaction-related data;

[0108] Execute the target transaction according to the execution command to obtain the execution result of the target transaction.

[0109] In one embodiment, when the processor 110 executes determining the transaction component required by the transaction request in response to the transaction request for the target transaction, the following operations are specifically performed:

[0110] In response to the transaction request for the target transaction, obtain the transaction type corresponding to the transaction request;

[0111] Determine the transaction component required by the transaction request based on the transaction type of the target transaction.

[0112] In one embodiment, when the processor 110 executes generating the execution command for the transaction component based on the transaction type of the target transaction, the following operations are specifically performed:

[0113] Determine the execution order of the transaction components based on the transaction type of the target transaction;

[0114] Generate an execution command for the transaction component based on the execution order.

[0115] In one embodiment, when the processor 110 executes generating the execution command for the transaction component based on the execution order, the following operations are specifically performed:

[0116] Obtain the preset scheduling policy configured for each transaction component;

[0117] Generate an execution command for the transaction component based on the preset scheduling policy and the execution order.

[0118] In one embodiment, when the processor 110 executes saving the execution command to the database transaction corresponding to the target transaction, the following operations are specifically performed:

[0119] Obtain the identification information of the target transaction;

[0120] Save the execution command to the database transaction corresponding to the target transaction based on the identification information.

[0121] In one embodiment, when the processor 110 executes executing the target transaction according to the execution command to obtain the execution result of the target transaction, the following operations are specifically performed:

[0122] Obtain the execution command from the database transaction, and call the corresponding transaction component interface according to the execution command to execute the sub-goal transactions of the target transaction, and obtain the sub-execution results of each sub-goal transaction;

[0123] Determine the execution result of the target transaction based on the sub-execution results.

[0124] In one embodiment, when the processor 110 executes obtaining the execution command from the database transaction and calling the corresponding transaction component interface according to the execution command to execute the sub-goal transactions of the target transaction, the following operations are specifically performed:

[0125] If the scheduling mode of the execution command is asynchronous immediate execution, obtain the execution command from the local database, call the corresponding transaction component interface according to the execution command to execute the sub-goal transactions of the target transaction, and determine that the execution command is in the processing state;

[0126] If the scheduling mode of the execution command is scheduled execution on time, determine that the execution command is in the initialization state, and when the scheduled time of the execution command arrives, transfer to the step of obtaining the execution command from the local database, calling the corresponding transaction component interface according to the execution command to execute the sub-goal transactions of the target transaction, and determining that the execution command is in the processing state.

[0127] In one embodiment, after the processor 110 executes obtaining the execution command from the database transaction, calling the corresponding transaction component interface according to the execution command to execute the sub-goal transactions of the target transaction, and obtaining the sub-execution results of each sub-goal transaction, the following operations are further performed:

[0128] If there is a sub-goal transaction with a sub-execution result of execution failure, regenerate the updated execution command for the sub-goal transaction according to the preset scheduling strategy, and call the corresponding transaction component interface according to the updated execution command to execute the sub-goal transaction.

[0129] In the embodiments of the present specification, by responding to a transaction request for a target transaction, determining the transaction components required by the transaction request, locally generating an execution command for the transaction components based on the transaction type of the target transaction, and saving the execution command to the database transaction corresponding to the target transaction through proximal deployment, the strong consistency and atomicity of the transaction are ensured. Then, the stored execution command is called from the database to execute the target transaction to obtain the execution result of the target transaction. By adopting this method, the successful saving of the execution command is ensured, the execution success rate of the target transaction is improved, and the deployment cost is low.

[0130] Furthermore, by responding to a transaction request for a target transaction, obtaining the transaction type corresponding to the transaction request, determining the transaction components required for the transaction request based on the transaction type of the target transaction, dynamically determining the execution order of the transaction components based on the transaction type of the target transaction, and generating a corresponding execution command, this method can more precisely adjust the transaction execution order, flexibly meet the requirements of different transactions, thereby improving the efficiency and pertinence of the execution process. In addition, obtaining the identification information of the target transaction and saving the execution command to the database transaction corresponding to the target transaction based on the identification information ensures that the state of the transaction can be tracked and restored, providing higher transaction traceability and security. After that, obtaining the execution command from the database transaction and calling the corresponding transaction component interface according to the execution command to execute the sub-target transactions of the target transaction, obtaining the sub-execution results of each sub-target transaction, and determining the execution result of the target transaction based on the sub-execution results can more precisely feedback and adjust the execution result of the target transaction according to the execution situation of the subtasks. It provides efficient and precise transaction execution control in more complex transaction scenarios, ensuring high consistency and high success rate.

[0131] In addition, an embodiment of this specification provides a computer program product, which includes a computer program. When the computer program is executed by a processor of an electronic device, the processor can at least implement the method provided in the foregoing Figures 2 to 7 illustrated embodiment.

[0132] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.

[0133] The foregoing disclosure is only a preferred embodiment of this specification. Of course, it cannot be used to limit the scope of rights of this specification. Therefore, equivalent changes made according to the claims of this specification still fall within the scope covered by this specification.

Claims

1. A transaction execution method, the method comprising: Responding to a transaction request for a target transaction, determining transaction components required by the transaction request; Generating an execution command for the transaction components based on the transaction type of the target transaction, and saving the execution command to a database transaction corresponding to the target transaction; The database transaction is used to store data related to the target transaction; Executing the target transaction according to the execution command to obtain an execution result of the target transaction.

2. The method according to claim 1, wherein the responding to a transaction request for a target transaction and determining transaction components required by the transaction request comprises: Responding to a transaction request for a target transaction, obtaining the transaction type corresponding to the transaction request; Determining transaction components required by the transaction request based on the transaction type of the target transaction.

3. The method according to claim 1, wherein the generating an execution command for the transaction components based on the transaction type of the target transaction comprises: Determining an execution order of the transaction components based on the transaction type of the target transaction; Generating an execution command for the transaction components based on the execution order.

4. The method according to claim 3, wherein the generating an execution command for the transaction components based on the execution order comprises: Obtaining a preset scheduling policy configured for each of the transaction components; Generating an execution command for the transaction components based on the preset scheduling policy and the execution order.

5. The method according to claim 1, wherein the saving the execution command to a database transaction corresponding to the target transaction comprises: Obtaining identification information of the target transaction; Saving the execution command to a database transaction corresponding to the target transaction based on the identification information.

6. The method according to claim 1, wherein the executing the target transaction according to the execution command to obtain an execution result of the target transaction comprises: Obtaining the execution command from the database transaction, and calling a corresponding transaction component interface according to the execution command to execute sub-target transactions of the target transaction to obtain sub-execution results of the sub-target transactions; Determining an execution result of the target transaction based on the sub-execution results.

7. The method according to claim 6, wherein the obtaining the execution command from the database transaction and calling a corresponding transaction component interface according to the execution command to execute sub-target transactions of the target transaction comprises: If the scheduling mode of the execution command is asynchronous immediate execution, obtaining the execution command from the local database, calling a corresponding transaction component interface according to the execution command to execute sub-target transactions of the target transaction, and determining that the execution command is in a processing state; If the scheduling mode of the execution command is scheduled execution on time, determining that the execution command is in an initialization state, and when the scheduled time of the execution command arrives, transferring to the step of obtaining the execution command from the local database, calling a corresponding transaction component interface according to the execution command to execute sub-target transactions of the target transaction, and determining that the execution command is in a processing state.

8. The method according to claim 6, after obtaining the execution command from the database transaction and invoking the corresponding transaction component interface according to the execution command to execute the sub-goal transactions of the target transaction, and obtaining the sub-execution results of each of the sub-goal transactions, further comprising: If there is a sub-goal transaction whose sub-execution result is execution failure, regenerate the update execution command for the sub-goal transaction according to a preset scheduling strategy, and invoke the corresponding transaction component interface according to the update execution command to execute the sub-goal transaction.

9. A transaction execution device, comprising: A determination unit, configured to determine the transaction components required by the transaction request in response to a transaction request for a target transaction; A generation unit, configured to generate an execution command for the transaction components based on the transaction type of the target transaction, and save the execution command to the database transaction corresponding to the target transaction; The database transaction is used to store target transaction-related data; An execution unit, configured to execute the target transaction according to the execution command to obtain the execution result of the target transaction, and update the transaction execution status according to the execution process of the target transaction.

10. An electronic device, comprising: A processor and a memory; Wherein the memory stores a computer program, and the computer program is adapted to be loaded and executed by the processor to perform the steps of the method according to any one of claims 1 to 8.

11. A storage medium, the storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

12. A computer program product, comprising: A computer program, when the computer program is executed by a processor of an electronic device, causes the processor to perform the steps of the method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Abnormal configuration identification method and device, storage medium, product and electronic equipment

    CN120631515A