Distributed transaction timing method, system, device, medium and product

By in the distributed transaction timing system, the timed execution node provides time-delay based on the local timestamp, the problem of synchronization delay between the node and the clock system is solved, the efficiency and effect of distributed transaction timing is improved, and the performance of the distributed system is improved.

CN119652458APending Publication Date: 2025-03-18CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411751300.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

In a distributed system, during the timing of distributed transactions, due to the delay in synchronization between the node and the clock system, the processing cycle is lengthened, affecting the performance of the entire distributed system.

Method used

By interacting transaction requests between the timed co-ordination point and the timed execution node, the timed execution node provides timed based on the local timestamp, rather than relying on the interaction between the timed execution node and the clock synchronization system.

Benefits of technology

Overcome the synchronization delay problem between nodes and clock systems, improve the efficiency and effectiveness of distributed transaction timing, and improve the performance of distributed systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119652458A_ABST
    Figure CN119652458A_ABST
Patent Text Reader

Abstract

The invention relates to a distributed transaction timing method, system and device, a medium and a product. The distributed transaction time service method is applied to a distributed transaction time service system, the distributed transaction time service system comprises a time service coordination node and a time service execution node, and the method comprises the following steps: the time service coordination node determines that a target time service transaction is received, if yes, a transaction processing request corresponding to the target time service transaction is transmitted to the time service execution node in real time, and the target time service transaction is a distributed transaction distributed to the time service execution node for independent processing; and the time service execution node extracts a local timestamp of the time service execution node based on the transaction processing request, and performs time service on the target time service transaction according to the local timestamp. By adopting the method, the time service effect of distributed transaction time service is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of distributed storage technology, and in particular to a distributed transaction timing method, system, computer device, computer-readable storage medium and computer program product. Background Art

[0002] With the continuous development of science and technology, distributed systems have been widely used in all walks of life. In distributed systems, data management is required through distributed transactions. For each distributed practice, it is necessary to apply for timestamps to ensure the atomicity, consistency, isolation and persistence of distributed transactions.

[0003] At present, in the process of distributed transaction timing, it is usually achieved through a global clock system. For example, each node of the distributed system maintains time synchronization with the global clock system through a time synchronization protocol, or multiple clock systems are horizontally expanded to synchronize clocks for cross-regional transactions. However, due to the delay in synchronization between nodes and clock systems, the processing cycle of distributed transactions is lengthened, which in turn makes it easy to affect the performance of the entire distributed system. Therefore, the current timing effect of distributed transaction timing is poor. Summary of the invention

[0004] Based on this, it is necessary to provide a distributed transaction timing method, system, computer device, computer-readable storage medium and computer program product to improve the timing effect of distributed transaction timing in response to the above technical problems.

[0005] In a first aspect, the present application provides a distributed transaction timing method, which is applied to a distributed transaction timing system, wherein the distributed transaction timing system includes a timing coordination node and a timing execution node, including:

[0006] The timing coordination node determines that the target timing transaction is received, and then transmits the transaction processing request corresponding to the target timing transaction to the timing execution node in real time, wherein the target timing transaction is a distributed transaction assigned to the timing execution node for separate processing;

[0007] The timing execution node extracts a local timestamp of the timing execution node based on the transaction processing request, and performs timing for the target timing transaction according to the local timestamp.

[0008] In one embodiment, the determining that a target timing transaction is received includes:

[0009] Get the transaction attribute information of the transaction to be timed;

[0010] When it is detected that the transaction attribute information satisfies a preset transaction attribute condition, the to-be-timing transaction is used as the target timing transaction.

[0011] In one embodiment, the real-time transmission of the transaction processing request corresponding to the target timing transaction to the timing execution node includes:

[0012] Obtaining transaction processing type information of the target timing transaction;

[0013] Generate a corresponding transaction processing request according to the transaction processing type information;

[0014] The transaction processing request is transmitted to the timing execution node in real time.

[0015] In one embodiment, the transaction processing type information includes first transaction processing type information and second transaction processing type information; and generating a corresponding transaction processing request according to the transaction processing type information includes:

[0016] encapsulating the target timing transaction into the transaction processing request according to the first transaction processing type information;

[0017] According to the second transaction type information, the transaction start time of the target timing transaction is requested from the global clock synchronization system, and the transaction start time and the target timing transaction are encapsulated together as the transaction request.

[0018] In one embodiment, the step of providing timing for the target timing transaction according to the local timestamp includes:

[0019] If the transaction processing start time is extracted from the transaction processing request, after the target timing transaction is processed, a transaction processing end time is allocated to the target timing transaction according to the local timestamp;

[0020] If the transaction processing start time is not extracted in the transaction processing request, before processing the target timing transaction, the transaction processing start time is allocated to the target timing transaction according to the local timestamp, and after processing the target timing transaction is completed, the transaction processing end time is allocated to the target timing transaction according to the local timestamp.

[0021] In one embodiment, the method further comprises:

[0022] The timing execution node obtains the global synchronization timestamp of the distributed transaction timing system;

[0023] The local timestamp is time synchronized according to the timestamp deviation value between the global synchronization timestamp and the local timestamp.

[0024] In a second aspect, the present application also provides a distributed transaction timing method system, comprising:

[0025] The timing coordination node is used to determine that a target timing transaction is received, and then transmit a transaction processing request corresponding to the target timing transaction to the timing execution node in real time, wherein the target timing transaction is a distributed transaction assigned to the timing execution node for separate processing;

[0026] The timing execution node is used to extract the local timestamp of the timing execution node based on the transaction processing request, and perform timing for the target timing transaction according to the local timestamp.

[0027] In one of the embodiments, the timing coordination node is further used for:

[0028] Get the transaction attribute information of the transaction to be timed;

[0029] When it is detected that the transaction attribute information satisfies a preset transaction attribute condition, the to-be-timing transaction is used as the target timing transaction.

[0030] In one of the embodiments, the timing coordination node is further used for:

[0031] Obtaining transaction processing type information of the target timing transaction;

[0032] Generate a corresponding transaction processing request according to the transaction processing type information;

[0033] The transaction processing request is transmitted to the timing execution node in real time.

[0034] In one embodiment, the transaction type information includes first transaction type information and second transaction type information; the timing coordination node is further used to:

[0035] encapsulating the target timing transaction into the transaction processing request according to the first transaction processing type information;

[0036] According to the second transaction type information, the transaction start time of the target timing transaction is requested from the global clock synchronization system, and the transaction start time and the target timing transaction are encapsulated together as the transaction request.

[0037] In one embodiment, the timing execution node is also used for:

[0038] The transaction processing start time is extracted from the transaction processing request, and after the target timing transaction is processed, a transaction processing end time is allocated to the target timing transaction according to the local timestamp;

[0039] If the transaction processing start time is not extracted in the transaction processing request, before processing the target timing transaction, the transaction processing start time is allocated to the target timing transaction according to the local timestamp, and after processing the target timing transaction is completed, the transaction processing end time is allocated to the target timing transaction according to the local timestamp.

[0040] In one embodiment, the distributed transaction timing method system further includes a time synchronization module, and the time synchronization module is further used to:

[0041] The timing execution node obtains the global synchronization timestamp of the distributed transaction timing system;

[0042] The local timestamp is time synchronized according to the timestamp deviation value between the global synchronization timestamp and the local timestamp.

[0043] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0044] When the timing coordination node determines that it has received the target timing transaction, it transmits the transaction processing request corresponding to the target timing transaction to the timing execution node in real time, wherein the target timing transaction is a distributed transaction assigned to the timing execution node for separate processing; the timing execution node extracts the local timestamp of the timing execution node based on the transaction processing request, and performs timing for the target timing transaction according to the local timestamp.

[0045] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0046] When the timing coordination node determines that it has received the target timing transaction, it transmits the transaction processing request corresponding to the target timing transaction to the timing execution node in real time, wherein the target timing transaction is a distributed transaction assigned to the timing execution node for separate processing; the timing execution node extracts the local timestamp of the timing execution node based on the transaction processing request, and performs timing for the target timing transaction according to the local timestamp.

[0047] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0048] When the timing coordination node determines that it has received the target timing transaction, it transmits the transaction processing request corresponding to the target timing transaction to the timing execution node in real time, wherein the target timing transaction is a distributed transaction assigned to the timing execution node for separate processing; the timing execution node extracts the local timestamp of the timing execution node based on the transaction processing request, and performs timing for the target timing transaction according to the local timestamp.

[0049] The above-mentioned distributed transaction timing method, system, computer device, computer-readable storage medium and computer program product first determine that the timing coordination node has received the target timing transaction assigned to the timing execution node for separate processing, and then transmit the transaction processing request corresponding to the target timing transaction to the timing execution node in real time, and then the timing execution node extracts the local timestamp of the timing execution node based on the transaction processing request, and finally performs timing for the target timing transaction based on the local timestamp. This can achieve the purpose of timing the target timing transaction based on the local timestamp of the timing execution node through information interaction between the timing coordination node and the timing execution node, rather than relying on the interaction between the timing execution node and the clock synchronization system in the process of timing the distributed transaction. Therefore, it overcomes the technical defect that the processing cycle of the distributed transaction is lengthened due to the delay in synchronization between the node and the clock system, which in turn makes it easy to affect the performance of the entire distributed system. Therefore, the timing effect of distributed transaction timing is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0051] Figure 1 A schematic diagram of a process flow of a distributed transaction timing method in one embodiment;

[0052] Figure 2 A schematic diagram of a distributed transaction timing process of a distributed transaction timing method in another embodiment;

[0053] Figure 3 A schematic diagram of a process of performing distributed transaction timing by a distributed transaction timing system of a distributed transaction timing method in an embodiment;

[0054] Figure 4 A schematic diagram of a flow chart of a distributed transaction timing method in another embodiment;

[0055] Figure 5 A flowchart of a distributed transaction timing method in an embodiment of a timing execution node performing time synchronization based on a local clock system;

[0056] Figure 6 A structural block diagram of a distributed transaction timing system in one embodiment;

[0057] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0059] First of all, it should be understood that with the continuous development of science and technology, the amount of data managed by a single information system has increased exponentially in the data age. At the same time, due to the limitations of hardware devices such as memory and CPU and cost considerations, the processing performance of a single information system for data processing has been seriously affected, and then distributed systems such as BigTable, GaussDB and Ceph have gradually emerged in the market, that is, a large and complex distributed storage system is constructed by multiple relatively low-cost devices through network interconnection and distributed technology. A distributed transaction refers to a transaction involving multiple devices operating a distributed storage system. In the process of executing distributed transactions, ensuring the ACID characteristics of the transaction is crucial for the distributed storage system. At present, the mainstream distributed storage system usually adopts the timestamp-based MVCC (Multi-Version Concurrency Control) mechanism to improve the concurrent performance of read and write operations. That is, a transaction start timestamp and a transaction end timestamp are assigned at the beginning and end of the transaction respectively. The conflict detection and visibility judgment of the transaction are based on these two timestamp mirrors, and the clock system that assigns timestamps to the distributed storage system is TSO (Timestamp Buffered Sequencer). The system can ensure high performance, high security and accuracy of timestamp allocation. The more common distributed systems such as TiDB, GaussDB and TDSQL all use the TSO system as the timing solution for distributed systems. However, in the process of distributed timing based on the TSO system, since a timestamp must be applied for each transaction, it is necessary to consider what timing method to use to ultimately achieve the performance of the clock system. This has become one of the urgent problems to be solved in distributed systems. In related technologies, there are methods of using a unique clock system to apply for timestamps for all transactions in a distributed system, and there are also methods of horizontally expanding multiple systems to solve the performance problems of the clock system. However, the above-mentioned distributed transaction timing methods all require the nodes of the distributed system to interact with the clock system, which will cause the delay problem of distributed transactions, and ultimately affect the performance of the entire distributed system. Therefore, there is an urgent need for a distributed transaction timing method that improves the timing effect of distributed transaction timing.

[0060] In one embodiment, Figure 1As shown, a distributed transaction timing method is provided. This embodiment takes the method applied to a distributed transaction timing system as an example. The distributed transaction timing system includes a timing coordination node and a timing execution node, wherein the timing coordination node and the timing execution node can be understood as terminals, and the terminals include but are not limited to personal computers, laptops, smart phones and tablet computers, etc. The timing coordination node of the distributed transaction timing system is used to determine that a target timing transaction is received, and then transmit a transaction processing request corresponding to the target timing transaction to the timing execution node in real time, wherein the target timing transaction is a distributed transaction assigned to the timing execution node for separate processing, and the distributed transaction The timing execution node of the timing system is used to extract the local timestamp of the timing execution node based on the transaction processing request, and to perform timing for the target timing transaction based on the local timestamp. By exchanging transaction processing requests between the timing coordination node and the timing execution node, the timing can be achieved by relying on the local timestamp of the timing execution node in the process of timing the target timing transaction, rather than relying on the interaction between the timing execution node and the clock synchronization system in the process of timing the distributed transaction. Therefore, the delay problem when the timing execution node synchronizes the clock with the clock system can be avoided, so the timing effect of the distributed transaction timing can be improved. In this embodiment, the method includes the following steps 202 to 204. Among them:

[0061] Step 202: The timing coordination node determines that a target timing transaction has been received, and then transmits a transaction processing request corresponding to the target timing transaction to the timing execution node in real time, wherein the target timing transaction is a distributed transaction assigned to the timing execution node for separate processing.

[0062] It should be noted that in a distributed transaction timing system, if multi-node transactions are involved, all nodes in the distributed transaction timing system are usually divided into coordinators and executors, among which the coordinator is responsible for the advancement of the overall transaction and the execution results of all participants in the coordination transaction, and determines the next state of the transaction based on the execution results. If any node fails to execute, the overall distributed transaction execution fails. The executor can also be called a participant, who is responsible for the actual execution of the read and write operations and returns the execution results to the coordinator. The coordinator of the distributed transaction timing system can be understood as a timing coordination node, and the executor of the distributed transaction timing system can be understood as a timing execution node. It can be understood that in the process of distributed transaction timing, the timing coordination node is the central node, responsible for unifying and scheduling the timing operations of each node, and the timing execution node is the node scheduled by the distributed transaction for the timing coordination node. The timing coordination node can transmit instructions to the timing execution node in real time for the timing execution node to perform the corresponding timing operations, among which the timing coordination node and the timing execution node can be connected for communication.

[0063] It should be noted that the target timing transaction is a distributed transaction assigned to a timing execution node for separate processing. It is understandable that a distributed transaction timing system usually includes a timing coordination node and multiple timing execution nodes. For a certain distributed transaction, it may be processed by a single timing execution node alone, or by multiple timing execution nodes together. For example, a distributed transaction may include a 1PC pure write transaction and a multi-PC pure write transaction, wherein a 1PC pure write transaction refers to the execution of a distributed transaction that can be completed by a single executor of a distributed system. It is understandable that a 1PC transaction may involve operations on one or more data. For example, all data of a distributed transaction are located on the same node, while a 2PC pure write transaction refers to the execution of a distributed transaction that is completed by multiple executors of a distributed system. For example, a distributed transaction needs to operate multiple data, and the multiple data are located on different nodes. The distributed transaction can specifically be data read and write operations on order tables, account tables, and warehouse tables.

[0064] It should be noted that this embodiment is aimed at improving the timing method of single-node transactions. For multi-node transactions, in the process of distributed transaction timing, timestamps will still be allocated through the global clock system. For example, refer to Figure 2 , Figure 2 The present invention is a flowchart of distributed transaction timing, wherein, for a target timing transaction, the timing will be completed by relying on the interaction between the timing coordination node and the timing execution node, while for a non-target timing transaction, the timing can be completed by the interaction among the timing coordination node, the timing execution node and the time synchronization system. It can be understood that after the timing coordination node receives the transaction to be timed, the type of transaction can be identified according to the transaction identifier of the transaction to be timed, wherein the transaction to be timed refers to a distributed transaction waiting for timing, and the transaction processing request refers to a processing request generated for the target timing transaction.

[0065] As an example, step 202 includes: after the client generates a pending timing transaction, the timing coordination node receives the pending timing transaction and identifies the pending timing transaction based on the transaction identifier of the received pending timing transaction. When it is identified that the pending timing transaction is a target timing transaction assigned to a timing execution node for separate processing, a transaction processing request corresponding to the pending timing transaction is generated, and the transaction processing request is transmitted to the timing execution node in real time.

[0066] Step 204: the timing execution node extracts the local timestamp of the timing execution node based on the transaction processing request, and performs timing for the target timing transaction according to the local timestamp.

[0067] It should be noted that the timing execution node has a new timestamp function, that is, the timing execution node is deployed with a local clock system. For the timing of the target timing transaction, the timing execution node can actively perform timing based on the local timestamp. For example, in an implementable method, for 1PC pure write transactions, the timing execution node allocates transaction timestamps, wherein the timing execution node's timing scheme through the local clock system can be consistent with the scheme of the global clock system, and the relevant codes of the global clock system scheme can be directly reused to ensure that the timestamp format allocated based on the local clock system is consistent.

[0068] As an example, step 204 includes: after receiving the transaction processing request, the timing execution node extracts the local timestamp of the timing execution node, and in the process of processing the target timing transaction, performs timing on the target timing transaction according to the local timestamp.

[0069] In one practicable manner, referring to Figure 3 , Figure 3 The flowchart of distributed transaction timing for the distributed transaction timing system is shown in the figure, wherein the client starts the transaction to be timed, and then sends the read and write operations of the transaction to be timed to the timing coordination node. The timing coordination node caches the write operation in the timing coordination node and returns the successful write of the transaction to the client. Then the client sends a commit operation to the timing coordination node. The timing coordination node determines whether the transaction to be timed is a 1PC pure write transaction, initiates a 1PC pure write transaction commit operation to the corresponding timing execution node, and then the timing execution node locally allocates the transaction processing start time of the transaction (if it has been applied in the read operation phase, this step is skipped), the timing execution node executes the transaction write operation, the timing execution node locally allocates the transaction processing end time of the transaction, and then the timing execution node returns to the timing coordination node after executing the commit operation, and then the timing coordination node returns to the client. After the client receives the commit response, the transaction ends.

[0070] In the above-mentioned distributed transaction timing method, the client first initiates the transaction to be timed. When the timing coordination node receives the transaction to be timed and identifies the transaction to be timed as the target timing transaction based on the transaction identifier of the transaction to be timed, the transaction processing request corresponding to the target timing transaction is transmitted to the timing execution node in real time. Then, after receiving the transaction processing request, the timing execution node extracts the local timestamp of the timing execution node and performs timing for the target timing transaction based on the local timestamp. The purpose of timing the target timing transaction can be achieved through information interaction between the timing coordination node and the timing execution node, based on the local timestamp of the timing execution node, instead of relying on the interaction between the timing execution node and the clock synchronization system in the process of timing the distributed transaction. Therefore, the technical defect that the processing cycle of the distributed transaction is lengthened due to the delay in synchronization between the node and the clock system, which easily affects the performance of the entire distributed system, is overcome. Therefore, the timing effect of distributed transaction timing is improved.

[0071] In one embodiment, Figure 4 As shown, determining that a target timing transaction is received includes:

[0072] Step 302: Acquire transaction attribute information of the transaction to be timed.

[0073] It should be noted that a transaction type identification function can be added to the timing coordination node so that the timing coordination node can actively determine whether the transaction to be timed is the target timing transaction. The transaction attribute information is used to characterize the characteristics of distributed transactions, which can be the definition of distributed transactions, protocol specifications, and specific implementation methods. It can be understood that the target timing transaction only involves one stage, namely the direct submission stage. In this stage, the initiator of the transaction will send a submission request to all involved resource managers. The transaction to be timed is a distributed transaction waiting for timing.

[0074] As an example, step 302 includes: extracting transaction attribute information of the transaction to be timed from the transaction to be timed.

[0075] Step 304: When it is detected that the transaction attribute information meets the preset transaction attribute condition, the transaction to be timed is used as the target timing transaction.

[0076] It should be noted that when determining the pending timing transaction, preset transaction attribute conditions will be designed, and the pending timing transaction will be identified by matching the transaction attribute information of the pending timing transaction with the preset transaction attribute conditions. For example, in one feasible method, if the timing coordination node detects that the transaction attribute information matches the preset transaction attribute conditions, the pending timing transaction is determined to be the target timing transaction, and the timing coordination node will further send a transaction commit operation to the corresponding executor, where transaction commit can be understood as a transaction processing request.

[0077] As an example, step 304 includes: when it is detected that the transaction attribute information matches the preset transaction attribute condition, taking the transaction to be timed as the target timing transaction.

[0078] In this embodiment, after receiving the transaction to be timed, the timing coordination node can extract the transaction attribute information of the transaction to be timed, and further actively identify whether the transaction to be identified is the target timing transaction by detecting the transaction attribute information and the satisfaction of preset transaction attribute conditions, so that the timing coordination node has initiative in the process of performing distributed transaction timing, thereby further improving the timing effect of distributed transactions.

[0079] In one embodiment, real-time transmission of a transaction processing request corresponding to a target timing transaction to a timing execution node includes:

[0080] Obtain the transaction processing type information of the target timing transaction; generate the corresponding transaction processing request according to the transaction processing type information; transmit the transaction processing request to the timing execution node in real time:

[0081] It should be noted that, in the process of the timing coordination node transmitting transaction processing requests in real time, if the transaction processing type of the target timing transaction is different, the timing coordination node will transmit different types of transaction processing requests to the timing execution node in real time. For example, in one feasible method, if the timing execution node performs pure write processing on the target timing transaction, the transaction processing start timestamp and the transaction processing end timestamp are allocated during the processing. If the timing execution node performs read and write processing on the target timing transaction, the timing execution node reads the transaction processing start timestamp in the read operation phase, and only allocates the transaction processing end timestamp during the processing. Therefore, the timing coordination node can generate different transaction processing requests based on the transaction processing type information for real-time transmission during the process of transmitting transaction processing requests in real time.

[0082] As an example, the transaction processing type information of the target timing transaction is extracted from the target timing transaction; a transaction processing request corresponding to the transaction processing type information is generated; and the transaction processing request is transmitted to the timing execution node in real time.

[0083] In this embodiment, the transaction processing type information of the target timing transaction is first extracted from the target timing transaction, and then a transaction processing request is made in a targeted manner through the transaction processing type information. Then, when the transaction types of the target timing transaction processing are different, a corresponding transaction processing request is generated, and the transaction processing request is transmitted to the timing execution node. This can avoid the timing execution node always performing the timing of the start timestamp and the end timestamp in the process of timing different target timing transactions. Therefore, while improving the timing effect of distributed transaction timing, the timing flexibility of distributed transaction timing is also improved.

[0084] In one embodiment, the transaction type information includes first transaction type information and second transaction type information; generating a corresponding transaction request according to the transaction type information includes:

[0085] According to the first transaction processing type information, the target timing transaction is encapsulated into a transaction processing request; according to the second transaction processing type information, the transaction processing start time of the target timing transaction is requested to the global clock synchronization system, and the transaction processing start time and the target timing transaction are encapsulated together into a transaction processing request.

[0086] It should be noted that the transaction processing type information includes first transaction processing type information and second transaction processing type information, wherein the first transaction processing type information is used to identify the target timing transaction as a pure write transaction, and the second transaction processing type information is used to identify the target timing transaction as a read-write transaction. When the target timing transaction is a read-write transaction, the timing coordination node can actively request the global clock synchronization system for the transaction processing start time of the target timing transaction, thereby eliminating the need for the timing execution node to allocate the transaction processing start time during the processing of the target timing transaction.

[0087] As an example, according to the first transaction processing type, the target timing transaction is encapsulated to obtain a transaction processing request corresponding to the target timing transaction; according to the second transaction processing type information, a time acquisition request is sent to the global clock synchronization system, and based on the time acquisition request, the transaction processing start time of the target timing transaction sent by the global clock synchronization system is received, and the transaction processing start time and the target timing transaction are encapsulated together into a transaction processing request.

[0088] In this embodiment, after the timing coordination node identifies that the timing transaction to be synchronized is the target timing transaction, the transaction processing type information is extracted from the target timing transaction, and when the transaction processing type information is the first transaction processing type information, the target timing transaction is directly encapsulated to obtain a transaction processing request, and when the transaction processing type information is the second transaction processing type information, the transaction processing start time and the target timing transaction transmitted by the global synchronization system are encapsulated together as a transaction processing request, thereby achieving the purpose of the timing coordination node generating transaction processing requests in a targeted manner based on different types of target timing transactions, thereby laying a foundation for improving the timing efficiency of distributed transaction timing.

[0089] In one embodiment, timing is performed for a target timing transaction according to a synchronization performance indicator and a local timestamp, including:

[0090] If the transaction processing start time is extracted in the transaction processing request, the transaction processing end time is allocated to the target timing transaction according to the local timestamp after the target timing transaction is processed; if the transaction processing start time is not extracted in the transaction processing request, the transaction processing start time is allocated to the target timing transaction according to the local timestamp before the target timing transaction is processed, and the transaction processing end time is allocated to the target timing transaction according to the local timestamp after the target timing transaction is processed.

[0091] It should be noted that after receiving the transaction processing request transmitted by the timing coordination node, the timing execution node will identify the request type of the transaction processing request. Specifically, it can identify whether the transaction processing request carries the transaction processing start time, and according to whether the transaction processing start time is carried, different timestamp allocation strategies are adopted to allocate timestamps in the process of processing the target timing transaction.

[0092] As an example, if the transaction processing start time is extracted in the transaction processing request, then after the target timing transaction is completed, the local timestamp after the transaction is completed is used as the transaction processing end time of the target timing transaction; if the transaction processing start time is not extracted in the transaction processing request, then before the target timing transaction is processed, the local timestamp before the target timing transaction is processed is used as the transaction start time of the target timing transaction, and after the target timing transaction is completed, the local timestamp after the target timing transaction is processed is used as the transaction processing end time of the target timing transaction.

[0093] In this embodiment, after receiving the transaction processing request transmitted by the authorization coordination node, the timing execution node adopts different timestamp allocation strategies according to the extraction of the transaction processing start time in the transaction processing request to perform timing for the target timing transaction, thereby avoiding the timing execution node always performing timing of the start timestamp and the end timestamp in the process of timing for different target timing transactions. Therefore, while improving the timing effect of distributed transaction timing, the timing flexibility of distributed transaction timing is also improved.

[0094] In one embodiment, the distributed transaction timing method further includes:

[0095] The timing execution node obtains the global synchronization timestamp of the distributed transaction timing system; and synchronizes the local timestamp according to the timestamp deviation value between the global synchronization timestamp and the local timestamp.

[0096] It should be noted that a clock synchronization function can also be deployed in the timing execution node to prevent a large deviation between the executor timestamp and the synchronization timestamp of the global clock system, that is, the timing execution node needs to be advanced according to the global clock system, and then a preset timestamp deviation threshold can be set, and then the local timestamp of the timing execution node is synchronized by comparing the timestamp deviation value with the preset timestamp deviation threshold, wherein the preset timestamp deviation threshold can be specifically 1s, 2s or 5s, etc. For example, in an implementable manner, time synchronization can be performed periodically, or the timing execution node can be advanced according to the timestamp of a non-target timing transaction.

[0097] As an example, the timing execution node obtains the global synchronization timestamp of the distributed transaction timing system requested from the global clock system; the global synchronization timestamp and the local timestamp are subtracted to obtain the timestamp deviation value between the global synchronization timestamp and the local timestamp, and the local timestamp is synchronized according to the relationship between the timestamp deviation value and the preset timestamp deviation threshold.

[0098] In this embodiment, the timing execution node will receive the local timestamp of the distributed transaction timing system in real time during the process of the distributed transaction timing system timing the distributed transaction, and synchronize the local timestamp of the timing execution node according to the size relationship between the local timestamp and the preset timestamp deviation threshold, thereby avoiding the situation where the clock deviation between the local timestamp of the timing execution node and the global synchronization timestamp of the distributed transaction timing system is large, thereby further improving the timing effect of distributed transaction timing.

[0099] In one practicable manner, referring to Figure 5 , Figure 5The flowchart represents the time synchronization of the timing execution node based on the local clock system, wherein the target timing transaction sent by the timing coordination node to the timing execution node carries the transaction timestamp, the local clock system can advance the local clock system according to the transaction timestamp, and can also periodically synchronize the TSO timestamp to advance the local clock system, the timing coordination node can apply for the transaction timestamp from the global time system, and the timing execution node can periodically advance the local clock system.

[0100] Based on the distributed transaction timing method of this embodiment, it is possible to achieve the purpose of timing the target timing transaction based on the local timestamp of the timing execution node through information interaction between the timing coordination node and the timing execution node, rather than relying on the interaction between the timing execution node and the clock synchronization system during the timing of the distributed transaction. Therefore, it overcomes the technical defect that the processing cycle of the distributed transaction is lengthened due to the delay in synchronization between the node and the clock system, which in turn makes it easy to affect the performance of the entire distributed system. Therefore, the timing effect of distributed transaction timing is improved.

[0101] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0102] Based on the same inventive concept, the embodiment of the present application also provides a distributed transaction timing system for implementing the above-mentioned distributed transaction timing method. The implementation scheme for solving the problem provided by the system is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more distributed transaction timing system embodiments provided below can refer to the limitations of the distributed transaction timing method above, and will not be repeated here.

[0103] In an exemplary embodiment, Figure 6 As shown, a distributed transaction timing system is provided, including:

[0104] The timing coordination node 401 is used to determine that a target timing transaction is received, and then transmit a transaction processing request corresponding to the target timing transaction to the timing execution node in real time, wherein the target timing transaction is a distributed transaction assigned to the timing execution node for separate processing;

[0105] The timing execution node 402 is used to extract the local timestamp of the timing execution node based on the transaction processing request, and perform timing for the target timing transaction according to the local timestamp.

[0106] In one embodiment, the timing coordination node 401 is further used for:

[0107] Acquire transaction attribute information of the transaction to be timed; and when it is detected that the transaction attribute information satisfies a preset transaction attribute condition, use the transaction to be timed as the target timing transaction.

[0108] In one embodiment, the timing coordination node 401 is further used for:

[0109] Acquire transaction processing type information of the target timing transaction; generate a corresponding transaction processing request according to the transaction processing type information; and transmit the transaction processing request to the timing execution node in real time.

[0110] In one embodiment, the transaction type information includes first transaction type information and second transaction type information; the timing coordination node 401 is further used for:

[0111] According to the first transaction processing type information, the target timing transaction is encapsulated as the transaction processing request; according to the second transaction processing type information, the transaction processing start time of the target timing transaction is requested to the global clock synchronization system, and the transaction processing start time and the target timing transaction are encapsulated together as the transaction processing request.

[0112] In one embodiment, the timing execution node 402 is further used for:

[0113] If the transaction processing start time is extracted from the transaction processing request, then after the processing of the target timing transaction is completed, the transaction processing end time is allocated to the target timing transaction according to the local timestamp; if the transaction processing start time is not extracted from the transaction processing request, then before processing the target timing transaction, the transaction processing start time is allocated to the target timing transaction according to the local timestamp; and after processing the target timing transaction is completed, the transaction processing end time is allocated to the target timing transaction according to the local timestamp.

[0114] In one embodiment, the distributed transaction timing method system further includes a time synchronization module, and the time synchronization module is further used to:

[0115] The timing execution node obtains a global synchronization timestamp of the distributed transaction timing system; and performs time synchronization on the local timestamp according to a timestamp deviation value between the global synchronization timestamp and the local timestamp.

[0116] Each module in the above-mentioned distributed transaction timing system can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0117] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input system. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input system are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a distributed transaction timing method is implemented. Those skilled in the art can understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0118] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0119] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0120] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0121] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0122] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0123] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A distributed transaction timing method, characterized in that: Applied to a distributed transaction timing system, the distributed transaction timing system includes a timing coordination node and a timing execution node, and the method includes: The timing coordination node determines that the target timing transaction is received, and then transmits the transaction processing request corresponding to the target timing transaction to the timing execution node in real time, wherein the target timing transaction is a distributed transaction assigned to the timing execution node for separate processing; The timing execution node extracts a local timestamp of the timing execution node based on the transaction processing request, and performs timing for the target timing transaction according to the local timestamp.

2. The method according to claim 1, characterized in that The step of determining that a target timing transaction is received comprises: Get the transaction attribute information of the transaction to be timed; When it is detected that the transaction attribute information satisfies a preset transaction attribute condition, the to-be-timing transaction is used as the target timing transaction.

3. The method according to claim 1, characterized in that: The real-time transmission of the transaction processing request corresponding to the target timing transaction to the timing execution node includes: Obtaining transaction processing type information of the target timing transaction; Generate a corresponding transaction processing request according to the transaction processing type information; The transaction processing request is transmitted to the timing execution node in real time.

4. The method according to claim 3, characterized in that The transaction processing type information includes first transaction processing type information and second transaction processing type information; and generating a corresponding transaction processing request according to the transaction processing type information includes: encapsulating the target timing transaction into the transaction processing request according to the first transaction processing type information; According to the second transaction type information, the transaction start time of the target timing transaction is requested from the global clock synchronization system, and the transaction start time and the target timing transaction are encapsulated together as the transaction request.

5. The method according to claim 4, characterized in that The performing timing for the target timing transaction according to the local timestamp includes: If the transaction processing start time is extracted from the transaction processing request, after the target timing transaction is processed, a transaction processing end time is allocated to the target timing transaction according to the local timestamp; If the transaction processing start time is not extracted in the transaction processing request, before processing the target timing transaction, the transaction processing start time is allocated to the target timing transaction according to the local timestamp, and after processing the target timing transaction is completed, the transaction processing end time is allocated to the target timing transaction according to the local timestamp.

6. The method according to claim 1, characterized in that The method further comprises: The timing execution node obtains the global synchronization timestamp of the distributed transaction timing system; The local timestamp is time synchronized according to the timestamp deviation value between the global synchronization timestamp and the local timestamp.

7. A distributed transaction timing system, characterized in that: The system comprises: The timing coordination node is used to determine that a target timing transaction is received, and then transmit a transaction processing request corresponding to the target timing transaction to the timing execution node in real time, wherein the target timing transaction is a distributed transaction assigned to the timing execution node for separate processing; The timing execution node is used to extract the local timestamp of the timing execution node based on the transaction processing request, and perform timing for the target timing transaction according to the local timestamp.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.