Transaction submission method and device, electronic equipment and storage medium
By introducing a local inspection mechanism between the transaction manager and the transaction coordinator in the distributed data system, the problem of low transaction submission efficiency caused by a single lock mechanism is solved, and a more efficient transaction submission process is achieved.
Patent Information
- Application Number
- CN202411624315.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-01-21
AI Technical Summary
In the prior art, a single lock mechanism leads to low efficiency in the transaction submission process.
By introducing a local check mechanism between the transaction manager and the transaction coordinator, the independence of the transaction process is verified, and after the check is passed, the transaction process is allowed to run independently to avoid unnecessary locking mechanisms.
It improves the efficiency of transaction submission, reduces lock competition issues, and improves the overall performance of the system.
Smart Images

Figure CN119336454A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of distributed data technology, and in particular to a transaction submission method, device, electronic device and storage medium. Background Art
[0002] When a transaction is executed, different processes in the transaction may operate on the same data. In this case, when multiple processes operate on the data, the processes need to be locked in sequence. When a process completes the operation, unlock the process and then lock the next process. The above single lock mechanism can ensure the execution order of the processes on the one hand, and facilitate the verification of each process on the other.
[0003] However, due to the existence of a single lock mechanism, the process must go through the lock-execution-unlock process before it can be executed. This mechanism affects the overall performance of the transaction submission system and makes the transaction submission process less efficient. Summary of the invention
[0004] The present application provides a transaction submission method, device, electronic device and storage medium, so as to at least solve the technical problem in the prior art that a single lock mechanism makes the transaction submission process inefficient.
[0005] In a first aspect, the present application provides a transaction submission method, the method is applied to a transaction manager, the transaction manager runs on a data node participating in the transaction, the method comprising:
[0006] In response to a first instruction, a local check is performed on the transaction process; wherein the first instruction is generated by a transaction coordinator connected to the transaction manager, and the local check is used to verify the independence of the transaction process;
[0007] When the inspection result obtained by the local inspection is a check-pass result, returning the check-pass result to the transaction coordinator;
[0008] In response to a second instruction, the transaction process is executed to complete the submission of the transaction; wherein the second instruction is an instruction generated by the transaction coordinator after receiving the check pass result.
[0009] In a feasible embodiment of the present application, after performing a partial check on the transaction process in response to the first instruction, the method further includes:
[0010] When the inspection result obtained by the local inspection is an inspection failure result, returning the inspection failure result to the transaction coordinator;
[0011] In response to a third instruction, the transaction process is controlled to be rolled back to a state before the local check; wherein the third instruction is an instruction generated by the transaction coordinator after receiving the check failure result.
[0012] In a feasible embodiment of the present application, in response to the first instruction, a local check is performed on the transaction process, including:
[0013] In response to the first instruction, performing a data validity check and / or a data dependency check on the transaction process;
[0014] In the case where both the data validity check and the data dependency check are passed, sending the check pass result to the transaction coordinator;
[0015] In the case that any one of the data validity check or the data dependency check fails, the check failure result is sent to the transaction coordinator.
[0016] In a feasible embodiment of the present application, after returning the check pass result to the transaction coordinator, the method further includes:
[0017] A pre-commit is performed to ensure that in the event of a failure in executing the transaction process, the transaction process is rolled back to the state before the pre-commit is performed; wherein the pre-commit at least includes the following operations: recording a rollback log of the transaction process and reserving computing resources for the transaction process.
[0018] In a second aspect, the present application provides a transaction submission method, the method is applied to a transaction coordinator, the transaction coordinator runs on a computing node participating in the transaction, the transaction coordinator is connected to multiple transaction managers, and the method includes:
[0019] In response to a transaction commit instruction, a first instruction is sent to the plurality of transaction managers; wherein the transaction commit instruction is used to indicate that the current transaction is ready to start committing, and the first instruction is used to instruct the transaction manager to perform a local check on the transaction process;
[0020] receiving the inspection result of the local inspection returned by the transaction manager; wherein the inspection result is a check pass result or a check fail result;
[0021] When all the check results returned by the transaction managers are check pass results, a second instruction is sent to all the transaction managers to enable all the transaction managers to execute the transaction process and complete the submission of the transaction.
[0022] In a feasible embodiment of the present application, after receiving the inspection result of the local inspection returned by the transaction manager, the method further includes:
[0023] When receiving the check result returned by any one of the transaction managers as a check failure result, a third instruction is sent to all the transaction managers, so that all the transaction managers control the transaction process to roll back, thereby completing the full rollback of the transaction.
[0024] In a third aspect, the present application provides a transaction submission device, which is applied to a transaction manager and is characterized in that the device includes:
[0025] A checking module, configured to perform a local check on a transaction process in response to a first instruction; wherein the first instruction is generated by a transaction coordinator connected to the transaction manager, and the local check is used to verify the independence of the transaction process;
[0026] A first returning module, configured to return the inspection pass result to the transaction coordinator if the inspection result obtained by the local inspection is an inspection pass result;
[0027] The commit module is used to execute the transaction process in response to a second instruction to complete the commit of the transaction; wherein the second instruction is an instruction generated by the transaction coordinator after receiving the check pass result.
[0028] In a fourth aspect, the present application provides a transaction submission device, which is applied to a transaction coordinator, and is characterized in that the device includes:
[0029] A first sending module, configured to send a first instruction to the plurality of transaction managers in response to a transaction commit instruction; wherein the transaction commit instruction is used to indicate that the current transaction is ready to start committing, and the first instruction is used to instruct the transaction manager to perform a local check on the transaction process;
[0030] A receiving module, configured to receive the inspection result of the local inspection returned by the transaction manager; wherein the inspection result is a check pass result or a check fail result;
[0031] The second sending module is used to send a second instruction to all the transaction managers when all the check results returned by the transaction managers are the check passing results, so as to make all the transaction managers execute the transaction process and complete the submission of the transaction.
[0032] In a fifth aspect, the present application provides an electronic device comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus, wherein the processor is configured to execute a transaction submission method described in any one of the embodiments of the first aspect or any one of the embodiments of the second aspect of the present application.
[0033] In a sixth aspect, the present application further provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute a transaction submission method described in any one of the embodiments of the first aspect or any one of the embodiments of the second aspect of the present application.
[0034] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:
[0035] Through the technical solution provided by the present application, the independence of each transaction process is ensured through local inspection. For the transaction process that has passed the local inspection, it can run independently during the transaction submission phase. Therefore, non-conflicting transaction processes do not need to be locked during the transaction submission phase, thereby improving the efficiency of transaction submission. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0037] 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0038] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0039] Figure 1 A flowchart of a transaction submission method applied to a transaction manager provided in an embodiment of the present application;
[0040] Figure 2 A flowchart of a transaction submission method applied to a transaction coordinator provided in an embodiment of the present application;
[0041] Figure 3An overall flow chart of a transaction submission method provided in an embodiment of the present application;
[0042] Figure 4 A schematic diagram of the structure of a transaction submission device applied to a transaction manager provided in an embodiment of the present application;
[0043] Figure 5 A schematic diagram of the structure of a transaction submission device applied to a transaction coordinator provided in an embodiment of the present application;
[0044] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are 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 making creative work are within the scope of protection of this application.
[0046] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0047] In order to solve the technical problem in the prior art that a single lock mechanism makes the transaction submission process inefficient, the present application provides a transaction submission method, device, electronic device and storage medium, which can improve the efficiency of the transaction submission process.
[0048] Figure 1 A flowchart of a transaction submission method applied to a transaction manager provided in an embodiment of the present application is provided, with reference to Figure 1 A transaction submission method provided in an embodiment of the present application can be applied to a transaction manager, and the transaction manager runs on a data node participating in the transaction. The method specifically includes the following steps:
[0049] S11: In response to a first instruction, a local check is performed on the transaction process; wherein the first instruction is generated by a transaction coordinator connected to the transaction manager, and the local check is used to verify the independence of the transaction process;
[0050] S12: When the inspection result obtained by the local inspection is a passing result, the passing result is returned to the transaction coordinator;
[0051] S13: In response to the second instruction, the transaction process is executed to complete the transaction submission; wherein the second instruction is an instruction generated by the transaction coordinator after receiving the check pass result.
[0052] Specifically, the transaction manager (TM) is distributed on each data node and is responsible for the management of local transactions and resource locking. The transaction submission method provided in the embodiment of the present application is mainly performed by the transaction manager during the processing of the transaction process. Each transaction manager is connected to the transaction coordinator (TC) distributed on the computing node. The transaction coordinator is used to globally manage and coordinate transactions, such as managing transactions to start, commit, roll back, and other operations.
[0053] When the system starts preparing to commit a transaction, multiple transaction processes of the transaction are initiated on different data nodes to operate on certain specific data. The transaction manager manages local transactions on the data nodes participating in the current transaction.
[0054] In the technical solution provided by the present application, any transaction manager, upon receiving a first instruction issued by a transaction coordinator, starts to perform a local check on its own transaction process. The first instruction is used to instruct the transaction manager to start a local check, which is used to verify the independence of the current transaction process.
[0055] It is understandable that for a transaction, when executing a transaction process in the transaction, multiple transaction processes may be interrelated. For example, transaction process A and transaction process B are restricted to a clear execution order, and transaction process B can only be executed after transaction process A is completed. In the above example, we believe that transaction process A and transaction process B are not independent. It can be seen that in the technical solution provided by this application, the local inspection of the transaction process can ensure that the transaction process will not be affected by other transaction processes during execution.
[0056] After completing the local inspection of the transaction process, the inspection result of the local inspection is returned to the transaction coordinator. If the inspection result is a passed result, the passed result is returned to the transaction coordinator. If the inspection result is a failed result, the failed result is returned to the transaction coordinator.
[0057] When the transaction manager receives the second instruction sent by the transaction coordinator, it starts to execute the transaction process, thereby completing the transaction submission. It can be understood that the transaction has integrity, that is, the transaction processes in the transaction must be executed in full or not at all, so when any transaction manager receives the second instruction, all transaction managers should receive the second instruction. Therefore, the transaction coordinator generates and sends the second instruction to each transaction manager only after receiving the check pass results returned by all transaction managers.
[0058] In a feasible embodiment of the present application, in order to ensure the integrity of the transaction, in step S11, after performing a partial check on the transaction process in response to the first instruction, the method further includes:
[0059] When the local check results in a failure result, the failure result is returned to the transaction coordinator;
[0060] In response to the third instruction, the transaction process is controlled to be rolled back to the state before the local check; wherein the third instruction is an instruction generated by the transaction coordinator after receiving a check failure result.
[0061] Specifically, when the transaction manager receives the third instruction sent by the transaction coordinator, it starts to control the transaction process to roll back. It can be understood that the transaction has integrity, that is, the transaction processes in the transaction must be executed in full or not executed at all. Therefore, when any transaction manager receives the third instruction, all transaction managers should receive the third instruction. Therefore, after receiving the check failure result returned by any transaction manager, the transaction coordinator generates and sends the third instruction to each transaction manager.
[0062] In a feasible embodiment of the present application, the local check is also used to ensure the effectiveness and accuracy of each transaction process. In step S11, in response to the first instruction, the transaction process is locally checked, specifically including the following steps:
[0063] In response to the first instruction, performing a data validity check and / or a data dependency check on the transaction process;
[0064] When both the data validity check and the data dependency check are passed, the check pass result is sent to the transaction coordinator;
[0065] If any one of the data validity check and the data dependency check fails, a check failure result is sent to the transaction coordinator.
[0066] Data validity check is used to check whether the data of transaction process operations meets the preset business rules or database constraints, such as value range, unique key conflict, etc. This check involves querying the database metadata to ensure that the data conforms to the expected format; data dependency check is used to confirm whether there is a potential dependency between transaction processes in the transaction, such as whether the update operation violates the ACID properties (atomicity, consistency, isolation, and durability), such as checking whether there are locking conflicts or concurrent modifications that may cause dirty reads.
[0067] It is understandable that when any transaction process passes the local check, the transaction process meets the current business standard and does not conflict with other transaction processes. The current transaction process can be executed independently when operating on data and has independence.
[0068] In a feasible embodiment of the present application, before the transaction manager performs a local check on the transaction process, the transaction manager also needs to pre-process the transaction process and lock resources. This process is consistent with the execution steps of the preparation phase of the transaction submission process in the prior art and will not be repeated here.
[0069] In a feasible embodiment of the present application, if the transaction process passes the local check, it means that the current transaction process itself will not have errors due to its own factors during execution, but when the transaction process is formally executed to realize transaction submission, external interference may affect the transaction submission, such as hardware errors or network errors. Therefore, we expect to set another layer of protection for transaction submission. In this embodiment, in step S12, after returning the check result to the transaction coordinator, the method also includes:
[0070] Pre-commit is performed to ensure that in the event of a transaction process failure, the transaction process is rolled back to the state before the pre-commit is performed; wherein the pre-commit includes at least the following operations: recording a rollback log of the transaction process and reserving computing resources for the transaction process.
[0071] Specifically, the pre-commit step is used to ensure that the transaction process can be rolled back more accurately after execution failure, so as to roll back to the state before pre-commit. The pre-commit process at least includes recording the rollback log of the transaction process and reserving some computing resources for the transaction process. When the transaction process fails to execute, the rollback operation is implemented based on the rollback log and the reserved computing resources.
[0072] In a feasible embodiment of the present application, in step S13, in response to the second instruction, the transaction process is executed, and after the transaction is submitted, the method further includes:
[0073] Send a commit success message to the transaction coordinator.
[0074] Through the technical solution provided by the present application, the independence of each transaction process is guaranteed through local inspection. For the transaction process that has passed the local inspection, it can run independently during the transaction submission phase. Therefore, non-conflicting transaction processes do not need to be locked during the transaction submission phase, thereby improving the waiting performance of transaction submission and avoiding potential lock competition problems, thereby improving the efficiency of transaction submission.
[0075] Figure 2 A flowchart of a transaction submission method applied to a transaction coordinator provided in an embodiment of the present application is provided, with reference to Figure 2 A transaction submission method provided in an embodiment of the present application can be applied to a transaction coordinator. The transaction coordinator runs on a computing node participating in the transaction. The transaction coordinator is connected to multiple transaction managers. The method specifically includes the following steps:
[0076] S21: In response to a transaction commit instruction, sending a first instruction to multiple transaction managers; wherein the transaction commit instruction is used to indicate that the current transaction is ready to start committing, and the first instruction is used to instruct the transaction manager to perform a local check on the transaction process;
[0077] S22: receiving the inspection result of the local inspection returned by the transaction manager; wherein the inspection result is a check pass result or a check fail result;
[0078] S23: When all the check results returned by the transaction managers are check pass results, a second instruction is sent to all the transaction managers to enable all the transaction managers to execute the transaction process and complete the transaction submission.
[0079] Specifically, the transaction coordinator performs global management of transaction submission to ensure the integrity of the transaction.
[0080] After receiving the transaction commit instruction initiated by the user, the transaction coordinator allocates transaction processes to each transaction manager and sends a first instruction to the transaction managers participating in the current transaction, so that the transaction managers perform a local check on the transaction process.
[0081] The transaction manager receives the inspection results of the local inspection returned by the transaction manager. When the inspection results returned by all transaction managers are all inspection pass results, it means that the transaction processes on all transaction managers have passed the local inspection, and the transaction processes do not affect each other and can be executed independently. At this time, the second instruction is sent to all transaction managers, and the transaction managers execute the transaction processes under the control of the second instruction to complete the submission of the transaction.
[0082] In a feasible embodiment of the present application, when the transaction manager completes the transaction process, it will send a commit success message to the transaction coordinator. At this time, the transaction coordinator can also send a commit success message to all participating objects of the current transaction to notify all participating objects that the current transaction is successfully committed. In this embodiment, the transaction coordinator sends a commit success message to all participating objects of the current transaction only after receiving the commit success message sent by all transaction managers.
[0083] In a feasible embodiment of the present application, in step S22, after performing a partial check on the transaction process in response to the first instruction, the method further includes:
[0084] When receiving a check result returned by any transaction manager indicating that the check fails, a third instruction is sent to all transaction managers so that all transaction managers control the transaction process to roll back, thereby completing the full rollback of the transaction.
[0085] Specifically, when receiving a check result returned by any transaction manager that the check fails, it means that the transaction process on a certain transaction manager has failed the local check. Since the transaction processes in the transaction are either all executed or not executed, if the transaction process on a certain transaction manager fails the local check, if the transaction is committed, it will cause a commit error. At this time, all transaction managers send a third instruction, and all transaction managers roll back under the control of the third instruction, and all transaction processes are rolled back to the state before the local check.
[0086] Through the technical solution provided by this application, the transaction coordinator manages transactions globally, ensuring that all transaction managers can uniformly execute transaction processes and complete transaction submission when all local checks are passed, and at the same time ensuring that all transaction managers can perform full rollback when a transaction process fails to pass the local check, thus ensuring the integrity of the transaction.
[0087] Figure 3 The overall flow chart of a transaction submission method provided in an embodiment of the present application is shown in FIG. Figure 3 The transaction submission method provided in the embodiment of the present application can actually be divided into multiple submission stages, which specifically include a preparation stage, a check stage, a pre-submission stage, a submission stage, a rollback stage, and a completion stage. The transaction submission method provided in the embodiment of the present application can include the following steps when implemented:
[0088] In the preparation phase:
[0089] S301: The TC receives a transaction commit instruction, allocates a transaction process to the TM, and controls the TM to start commit preparation;
[0090] S302: TM prepares for submission, preprocesses the transaction process, and locks resources;
[0091] S303: After the TM completes the submission preparation, it notifies the TC and enters the inspection stage;
[0092] During the inspection phase:
[0093] S304: The TC generates a first instruction and sends the first instruction to the TM;
[0094] S305: The TM performs a local check on the transaction process in response to the first instruction, and sends the check result to the TC;
[0095] S306: The TC determines whether all transaction processes have passed the local check based on the check result; if all transaction processes have passed the local check, a second instruction is generated and sent to the TM, and the pre-commit phase is entered; if any transaction process has not passed the local check, a third instruction is generated and sent to the TM, and the rollback phase is entered;
[0096] During the pre-commit phase:
[0097] S307: TM generates a rollback log for the transaction process and reserves computing resources. After completion, it enters the commit phase.
[0098] During the submission phase:
[0099] S308: The TM responds to the second instruction and starts executing the transaction process, and sends a submission success message to the TC after the execution is completed;
[0100] S309: TC receives submission success information returned by all TMs and enters the completion phase;
[0101] At the completion stage:
[0102] S310: TC forwards the submission success information to all objects participating in the transaction, completing the submission of the transaction;
[0103] During the rollback phase:
[0104] S311: The TM controls the transaction process to roll back in response to the third instruction.
[0105] Figure 4 The present invention provides a structural diagram of a transaction submission device applied to a transaction manager in an embodiment of the present invention. Corresponding to the above-mentioned partial method embodiments, the present invention also provides a transaction submission device, which can be applied to a transaction manager. Of course, the device can also be the transaction manager itself. Figure 4 , the device comprises:
[0106] A check module 401 is used to perform a local check on the transaction process in response to a first instruction; wherein the first instruction is generated by a transaction coordinator connected to the transaction manager, and the local check is used to verify the independence of the transaction process;
[0107] A first returning module 402 is used to return the check result to the transaction coordinator when the check result obtained by the local check is a check pass result;
[0108] The commit module 403 is used to execute the transaction process in response to the second instruction and complete the transaction commit; wherein the second instruction is an instruction generated by the transaction coordinator after receiving the check pass result.
[0109] In a feasible embodiment of the present application, the device further includes:
[0110] A second return module is used to return the check failure result to the transaction coordinator when the check result obtained by the local check is a check failure result;
[0111] The rollback module is used to control the transaction process to roll back in response to a third instruction, and roll back the transaction process to the state before the local check; wherein the third instruction is an instruction generated by the transaction coordinator after receiving a check failure result.
[0112] In a feasible embodiment of the present application, the inspection module 401 includes:
[0113] A checking unit, configured to perform a data validity check and / or a data dependency check on the transaction process in response to the first instruction;
[0114] A first sending unit, configured to send a check pass result to the transaction coordinator when both the data validity check and the data dependency check are passed;
[0115] The second sending unit is used to send a check failure result to the transaction coordinator when any one of the data validity check and the data dependency check fails.
[0116] In a feasible embodiment of the present application, the device further includes:
[0117] The pre-commit module is used to perform pre-commit to ensure that in the event of a transaction process failure, the transaction process is rolled back to the state before the pre-commit; wherein the pre-commit includes at least the following operations: recording a rollback log of the transaction process and reserving computing resources for the transaction process.
[0118] Figure 5A schematic diagram of a transaction submission device applied to a transaction coordinator provided in an embodiment of the present application. Corresponding to the above-mentioned partial method embodiments, an embodiment of the present application further provides a transaction submission device, which can be applied to a transaction coordinator. Of course, the device can also be the transaction coordinator itself. Figure 5 , the device comprises:
[0119] A first sending module 501 is used to send a first instruction to multiple transaction managers in response to a transaction commit instruction; wherein the transaction commit instruction is used to indicate that the current transaction is ready to start committing, and the first instruction is used to instruct the transaction manager to perform a local check on the transaction process;
[0120] The receiving module 502 is used to receive the inspection result of the local inspection returned by the transaction manager; wherein the inspection result is a check pass result or a check fail result;
[0121] The second sending module 503 is used to send a second instruction to all transaction managers when all the check results returned by the transaction managers are check pass results, so that all the transaction managers execute the transaction process and complete the transaction submission.
[0122] In a feasible embodiment of the present application, the device further includes:
[0123] The third sending module is used to send a third instruction to all transaction managers when receiving a check result returned by any transaction manager that the check fails, so that all transaction managers control the transaction process to roll back and complete the full rollback of the transaction.
[0124] like Figure 6 As shown, an embodiment of the present application provides an electronic device, including a processor 601, a communication interface 602, a memory 603 and a communication bus 604, wherein the processor 601, the communication interface 602, and the memory 603 communicate with each other through the communication bus 604.
[0125] Memory 603, used for storing computer programs;
[0126] In one embodiment of the present application, the processor 601 is used to execute the program stored in the memory 603 to implement the steps of a transaction submission method provided by any of the above method embodiments, for example, including:
[0127] In response to a first instruction, a local check is performed on the transaction process; wherein the first instruction is generated by a transaction coordinator connected to the transaction manager, and the local check is used to verify the independence of the transaction process;
[0128] When the inspection result obtained by the local inspection is a passing result, the passing result is returned to the transaction coordinator;
[0129] In response to the second instruction, the transaction process is executed to complete the transaction submission; wherein the second instruction is an instruction generated by the transaction coordinator after receiving the check pass result.
[0130] or,
[0131] In response to a transaction commit instruction, a first instruction is sent to multiple transaction managers; wherein the transaction commit instruction is used to indicate that the current transaction is ready to start committing, and the first instruction is used to instruct the transaction manager to perform a local check on the transaction process;
[0132] Receive the inspection result of the local inspection returned by the transaction manager; wherein the inspection result is a check pass result or a check fail result;
[0133] When all the check results returned by the transaction managers are check pass results, a second instruction is sent to all the transaction managers to enable all the transaction managers to execute the transaction process and complete the transaction submission.
[0134] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of a transaction submission method provided by any of the aforementioned method embodiments are implemented.
[0135] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0136] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0137] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0138] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A transaction submission method, characterized in that: The method is applied to a transaction manager, the transaction manager runs on a data node participating in the transaction, and the method comprises: In response to a first instruction, a local check is performed on the transaction process; wherein the first instruction is generated by a transaction coordinator connected to the transaction manager, and the local check is used to verify the independence of the transaction process; When the inspection result obtained by the local inspection is a check-pass result, returning the check-pass result to the transaction coordinator; In response to a second instruction, the transaction process is executed to complete the submission of the transaction; wherein the second instruction is an instruction generated by the transaction coordinator after receiving the check pass result.
2. The method according to claim 1, characterized in that: After performing a partial check on the transaction process in response to the first instruction, the method further includes: When the inspection result obtained by the local inspection is an inspection failure result, returning the inspection failure result to the transaction coordinator; In response to a third instruction, the transaction process is controlled to be rolled back to a state before the local check; wherein the third instruction is an instruction generated by the transaction coordinator after receiving the check failure result.
3. The method according to claim 2, characterized in that In response to the first instruction, a local check is performed on the transaction process, including: In response to the first instruction, performing a data validity check and / or a data dependency check on the transaction process; When both the data validity check and the data dependency check are passed, sending the check pass result to the transaction coordinator; In the case that any one of the data validity check or the data dependency check fails, the check failure result is sent to the transaction coordinator.
4. The method according to claim 1, characterized in that After returning the check pass result to the transaction coordinator, the method further includes: A pre-commit is performed to ensure that in the event of a failure in executing the transaction process, the transaction process is rolled back to the state before the pre-commit is performed; wherein the pre-commit at least includes the following operations: recording a rollback log of the transaction process and reserving computing resources for the transaction process.
5. A transaction submission method, characterized in that: The method is applied to a transaction coordinator, the transaction coordinator runs on a computing node participating in the transaction, the transaction coordinator is connected to multiple transaction managers, and the method includes: In response to a transaction commit instruction, a first instruction is sent to the plurality of transaction managers; wherein the transaction commit instruction is used to indicate that the current transaction is ready to start committing, and the first instruction is used to instruct the transaction manager to perform a local check on the transaction process; receiving the inspection result of the local inspection returned by the transaction manager; wherein the inspection result is a check pass result or a check fail result; When all the check results returned by the transaction managers are check pass results, a second instruction is sent to all the transaction managers to enable all the transaction managers to execute the transaction process and complete the submission of the transaction.
6. The method according to claim 5, characterized in that After receiving the inspection result of the local inspection returned by the transaction manager, the method further includes: When receiving the check result returned by any one of the transaction managers as a check failure result, a third instruction is sent to all the transaction managers, so that all the transaction managers control the transaction process to roll back, thereby completing the full rollback of the transaction.
7. A transaction submission device, the device being applied to a transaction manager, characterized in that: The device comprises: A checking module, configured to perform a local check on a transaction process in response to a first instruction; wherein the first instruction is generated by a transaction coordinator connected to the transaction manager, and the local check is used to verify the independence of the transaction process; A first returning module, configured to return the inspection pass result to the transaction coordinator if the inspection result obtained by the local inspection is an inspection pass result; The commit module is used to execute the transaction process in response to a second instruction to complete the commit of the transaction; wherein the second instruction is an instruction generated by the transaction coordinator after receiving the check pass result.
8. A transaction submission device, the device being applied to a transaction coordinator, characterized in that: The device comprises: A first sending module, configured to send a first instruction to the plurality of transaction managers in response to a transaction commit instruction; wherein the transaction commit instruction is used to indicate that the current transaction is ready to start committing, and the first instruction is used to instruct the transaction manager to perform a local check on the transaction process; A receiving module, configured to receive the inspection result of the local inspection returned by the transaction manager; wherein the inspection result is a check pass result or a check fail result; The second sending module is used to send a second instruction to all the transaction managers when all the check results returned by the transaction managers are the check passing results, so as to make all the transaction managers execute the transaction process and complete the submission of the transaction.
9. An electronic device, characterized in that: include: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor coupled to the at least one bus; At least one memory connected to the at least one bus, wherein the processor is configured to implement the method described in any one of claims 1 to 4 or is configured to implement the method described in any one of claims 5 to 6.
10. A computer storage medium, characterized in that: Computer executable instructions are stored, and the computer executable instructions are used to execute the method according to any one of claims 1 to 4 or to execute the method according to any one of claims 5 to 6.