Distributed transaction time service method, device and equipment, readable storage medium and product
By determining the target clock system based on transaction properties and expanding the clock system horizontally, the problem that the performance of the central timing scheme in a distributed storage system is limited by a single point bottleneck is solved, and the clock system performance is improved.
Patent Information
- Application Number
- CN202411628405.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-02-25
AI Technical Summary
In distributed storage systems, the performance of the central timing scheme is limited by a single point bottleneck, and the clock system is easily a bottleneck in system performance.
By determining the target clock system based on transaction properties and expanding the clock system horizontally in a distributed storage system, timing efficiency is improved.
It improves the performance of the clock system in a distributed storage system, avoids single point bottlenecks, and improves the overall performance of the system.
Smart Images

Figure CN119519873A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a distributed transaction timing method, apparatus, device, readable storage medium and product. Background Art
[0002] With the growth of data in the new century, distributed storage systems have emerged. Various distributed storage systems can be applied to various industries.
[0003] In distributed storage systems, the central timing solution is usually used as the timing solution for distributed storage systems. Compared with the hybrid logical clock, the central timing solution is simple and has a lower cost.
[0004] However, the performance of the central timing solution is subject to a single point bottleneck, and the clock system can easily become the performance bottleneck of the entire distributed storage system. Therefore, how to improve the performance of the clock system in the distributed storage system is an urgent problem to be solved. Summary of the invention
[0005] Based on this, it is necessary to provide a distributed transaction timing method, device, equipment, readable storage medium and product that can improve the performance of the clock system in a distributed storage system in response to the above technical problems.
[0006] In a first aspect, the present application provides a distributed transaction timing method, comprising:
[0007] Receiving a current pending transaction sent by a client; wherein the distributed storage system includes a client;
[0008] Determine the target clock system corresponding to the current pending transaction according to the transaction attribute of the current pending transaction; wherein the transaction attribute includes a transaction type;
[0009] Based on the target clock system, time is provided for the current transaction to be processed.
[0010] In one of the embodiments, according to the transaction attribute of the current pending transaction, a target business system responsible for processing the current pending transaction is determined; wherein the distributed storage system includes at least two business systems and at least one clock system; at least some of the business systems correspond to different clock systems;
[0011] The clock system corresponding to the target business system is used as the target clock system corresponding to the current transaction to be processed.
[0012] In one embodiment, there is no transaction interaction between different business systems.
[0013] In one embodiment, timing the current pending transaction based on the target clock system includes:
[0014] Using the first time information of the target clock system at the current moment as the transaction start timestamp of the current transaction to be processed;
[0015] Accordingly, after timing the current transaction to be processed based on the target clock system, the method further includes:
[0016] Sending a transaction processing instruction corresponding to the current pending transaction to a transaction executor to instruct the transaction executor to process the current pending transaction;
[0017] The distributed storage system includes a transaction executor; the transaction processing instruction carries the current transaction to be processed and a transaction start timestamp of the current transaction to be processed.
[0018] In one embodiment, the method further comprises:
[0019] Obtaining the transaction processing result fed back by the transaction executor;
[0020] Determine the submission time information of the transaction processing result;
[0021] The commit time information is used as the transaction commit timestamp of the current transaction to be processed.
[0022] In one embodiment, determining the submission time information of the transaction processing result includes:
[0023] Feedback the transaction processing result to the client;
[0024] In response to the transaction commit instruction sent by the client, obtaining second time information of the target clock system at the current moment;
[0025] The second time information is used as the submission time information.
[0026] In a second aspect, the present application also provides a distributed transaction timing device, including:
[0027] A transaction receiving module, used to receive a current pending transaction sent by a client; wherein the distributed storage system includes a client;
[0028] A clock system determination module, configured to determine a target clock system corresponding to the current pending transaction according to a transaction attribute of the current pending transaction; wherein the transaction attribute includes a transaction type;
[0029] A timing module is used to provide timing for the current transaction to be processed based on the target clock system.
[0030] 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:
[0031] Receiving a current pending transaction sent by a client; wherein the distributed storage system includes a client;
[0032] Determine the target clock system corresponding to the current pending transaction according to the transaction attribute of the current pending transaction; wherein the transaction attribute includes a transaction type;
[0033] Based on the target clock system, time is provided for the current transaction to be processed.
[0034] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:
[0035] Receiving a current pending transaction sent by a client; wherein the distributed storage system includes a client;
[0036] Determine the target clock system corresponding to the current pending transaction according to the transaction attribute of the current pending transaction; wherein the transaction attribute includes a transaction type;
[0037] Based on the target clock system, time is provided for the current transaction to be processed.
[0038] 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:
[0039] Receiving a current pending transaction sent by a client; wherein the distributed storage system includes a client;
[0040] Determine the target clock system corresponding to the current pending transaction according to the transaction attribute of the current pending transaction; wherein the transaction attribute includes a transaction type;
[0041] Based on the target clock system, time is provided for the current transaction to be processed.
[0042] In the above-mentioned distributed transaction timing method, apparatus, equipment, readable storage medium and product, the transaction coordinator receives the current pending transaction sent by the client; determines the target clock system corresponding to the current pending transaction according to the transaction attributes of the current pending transaction; wherein the transaction attributes include the transaction type; and performs timing for the current pending transaction based on the target clock system. In the above process, different clock systems are set for different transaction types, and timing is performed for the current pending transaction based on the target clock system corresponding to the current pending transaction. Compared with the traditional technology, in which the entire distributed storage system is only provided with one clock system, the present application can improve the timing efficiency of the clock system by horizontally expanding the clock system, thereby improving the performance of the clock system of the distributed storage system. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 An application environment diagram of a distributed transaction timing method in one embodiment;
[0045] Figure 2 A schematic diagram of a process flow of a distributed transaction timing method in one embodiment;
[0046] Figure 3 A schematic diagram of a flow chart of a target clock system determination step in one embodiment;
[0047] Figure 4A A schematic diagram of a flow chart of a timing step for a currently pending transaction in one embodiment;
[0048] Figure 4B A schematic diagram of a distributed storage system configuration in one embodiment;
[0049] Figure 5 A schematic diagram of a process for determining a transaction commit timestamp in one embodiment;
[0050] Fig. 6A It is an application environment diagram of a distributed transaction timing method in another embodiment;
[0051] Figure 6B A schematic diagram of a flow chart of a distributed transaction timing method in another embodiment;
[0052] Figure 7 A structural block diagram of a distributed transaction timing device in one embodiment;
[0053] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0054] 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.
[0055] The distributed transaction timing method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown in FIG. 1 , the client 102 is connected to the transaction coordinator 202 in the distributed storage system 20 through a network. Specifically, the transaction coordinator 202 receives the current pending transaction sent by the client 102; the transaction coordinator 202 determines the target clock system corresponding to the current pending transaction according to the transaction attribute of the current pending transaction; wherein the transaction attribute includes the transaction type; the transaction coordinator 202 performs time synchronization for the current pending transaction based on the target clock system.
[0056] In an exemplary embodiment, Figure 2 As shown, a distributed transaction timing method is provided, which is applied to Figure 1 Taking the transaction coordinator 202 in the example as an example, the following steps are included:
[0057] S210, receiving the current pending transaction sent by the client.
[0058] Among them, the current pending transaction is the distributed read and write transaction that needs to be processed at the current moment.
[0059] Exemplarily, the client receives the distributed read / write transaction input by the user, and sends the distributed read / write transaction as a pending transaction to the transaction coordinator. It should be noted that when sending the current pending transaction, the client can also synchronously send the transaction processing instruction corresponding to the current pending transaction.
[0060] It should be noted that, in this embodiment, the number of transaction coordinators is not unique. The transaction coordinator that currently receives the pending transaction sent by the client may be any one of the multiple transaction coordinators, for example, a currently idle one.
[0061] S220: Determine a target clock system corresponding to the current transaction to be processed according to the transaction attribute of the current transaction to be processed.
[0062] The transaction attributes include the transaction type, which is used to indicate the read and write task type of the transaction. For example, the transaction type includes data read type, data write type, and data read and write type. The transaction attributes also include the database corresponding to the transaction. Exemplarily, the data corresponding to the current pending transaction is written into the database as the database corresponding to the current pending transaction.
[0063] Exemplarily, in this embodiment, different transaction attributes correspond to different clock systems. In this embodiment, the correspondence between the reference transaction attribute and the reference clock system can be predetermined, and the reference clock system corresponding to the current pending transaction in the correspondence is used as the target clock system corresponding to the current pending transaction.
[0064] S230, based on the target clock system, timing is performed for the current transaction to be processed.
[0065] Specifically, in this embodiment, the time information recorded by the target clock system is used to provide time for the current transaction to be processed. For example, the time information recorded by the target clock system is used to provide time stamps for the current transaction to be processed at different processing stages.
[0066] In the above-mentioned distributed transaction timing method, the transaction coordinator receives the current pending transaction sent by the client; determines the target clock system corresponding to the current pending transaction according to the transaction attributes of the current pending transaction; wherein the transaction attributes include the transaction type; and performs timing for the current pending transaction based on the target clock system. In the above process, different clock systems are set for different transaction types, and timing is performed for the current pending transaction based on the target clock system corresponding to the current pending transaction. Compared with the traditional technology, in which the entire distributed storage system is only provided with one clock system, the present application can improve the timing efficiency of the clock system by horizontally expanding the clock system, thereby improving the performance of the clock system of the distributed storage system.
[0067] Based on the technical solutions of the above embodiments, the present application also provides an optional embodiment. In this optional embodiment, the process of determining the target clock system corresponding to the current pending transaction according to the transaction attribute of the current pending transaction is further introduced.
[0068] See also Figure 3 The target clock system determination steps shown include:
[0069] S310, determining a target business system responsible for processing the current transaction to be processed according to the transaction attributes of the current transaction to be processed.
[0070] The distributed storage system includes at least two business systems and at least one clock system; at least some of the business systems correspond to different clock systems. The transactions processed by different business systems have different transaction attributes. In this embodiment, the time information recorded by different clock systems can be the same or different.
[0071] Exemplarily, in this embodiment, different transaction attributes correspond to different business systems. In this embodiment, the correspondence between the reference transaction attributes and the reference business system can be predetermined, and the reference business system corresponding to the current pending transaction in the correspondence is used as the target business system corresponding to the current pending transaction.
[0072] In this embodiment, the correspondence between the reference transaction attribute and the reference business system can be stored in a preset database, for example, it can be pre-stored in the master corresponding to the distributed storage system. Accordingly, after receiving the current pending transaction, the transaction coordinator obtains the correspondence from the master, and determines the target business system responsible for processing the current pending transaction based on the transaction attribute of the current pending transaction and the correspondence.
[0073] It should be noted that the division of business systems can also be carried out according to the following logic: division according to departmental business, division according to business system, division according to database name, division according to database table name, division according to namespace, etc. However, if the processing flow of the current pending transaction needs to circulate in different business systems, and the time information recorded by the clock systems between different business systems may be different, then at this time, different clock systems will all perform time synchronization for the current pending transaction. At this time, the timestamps of the same type of the current pending transaction may be different. In order to avoid the occurrence of such phenomena and to ensure the uniqueness of the timestamp of the current pending transaction, in this embodiment, there is no transaction interaction between different business systems. In other words, when classifying business systems, the classification principle is: to ensure that there is no transaction interaction between different business systems, that is, the same distributed transaction will not be processed at the same time.
[0074] S320: Use the clock system corresponding to the target business system as the target clock system corresponding to the current transaction to be processed.
[0075] In this embodiment, different business systems correspond to different clock systems, and the time information recorded in different clock systems may be different.
[0076] Specifically, in this embodiment, the clock system corresponding to the target business system that processes the current transaction to be processed is used as the target clock system corresponding to the current transaction to be processed.
[0077] In the above embodiment, the process of determining the target clock system corresponding to the current pending transaction according to the transaction attribute of the current pending transaction is further introduced. Specifically, different business systems correspond to different clock systems, and the time information recorded by different clock systems may be different. By horizontally expanding the clock system, the timing efficiency of the clock system can be improved.
[0078] Based on the technical solutions of the above embodiments, the present application also provides an optional embodiment. In this optional embodiment, the above process of providing timing for the current transaction to be processed based on the target clock system is refined.
[0079] See also Figure 4A The steps shown are for timing the current transaction to be processed, including:
[0080] S410: Use the first time information of the target clock system at the current moment as the transaction start timestamp of the current transaction to be processed.
[0081] The first time information is the time information recorded by the target clock system corresponding to the current pending transaction when the transaction coordinator receives the current pending transaction. The transaction start timestamp is used to record the start processing time corresponding to the current pending transaction.
[0082] In this embodiment, the first time information is acquired, and the first time information is used as the transaction start timestamp of the current transaction to be processed.
[0083] Correspondingly, after determining the transaction start timestamp of the current pending transaction, the method further includes: sending a transaction processing instruction corresponding to the current pending transaction to a transaction executor to instruct the transaction executor to process the current pending transaction.
[0084] Among them, the distributed storage system includes a transaction executor, which is the actual executor of the current pending transaction. In this embodiment, the number of transaction executors is not unique, and the same transaction executor can execute distributed transactions corresponding to different business systems. The transaction processing instruction carries the current pending transaction and the transaction start timestamp of the current pending transaction.
[0085] In the above embodiment, when the transaction coordinator receives the current pending transaction, the first time information recorded by the target clock system corresponding to the current pending transaction is used as the transaction start timestamp of the current pending transaction, so as to record the start processing time of the current pending transaction.
[0086] In order to facilitate those skilled in the art to understand the configuration logic of the clock system of the distributed storage system in this application, see Figure 4BThe distributed storage system configuration diagram shown in the figure takes the division of different business systems in the distributed storage system based on the database name as an example to introduce the expansion method of the clock system of the distributed storage system:
[0087] First, create multiple corresponding databases, such as DB1, DB2, DB3, DB4, etc.; second, divide the clock system for each database. Each database belongs to a different business system, such as: DB1 belongs to business system 1, DB2 belongs to business system 2, DB3 and DB4 belong to business system 3 (multiple DBs can belong to the same business system). The mapping relationship is persisted in the master of the system; further, each business system corresponds to an independent clock system, and the mapping relationship is persisted in the master of the system.
[0088] Based on the technical solutions of the above embodiments, the present application also provides an optional embodiment. In this optional embodiment, the steps after sending the transaction processing instruction corresponding to the current pending transaction to the transaction executor are introduced.
[0089] See also Figure 5 The transaction commit timestamp determination steps shown include:
[0090] S510, obtaining the transaction processing result fed back by the transaction executor.
[0091] Exemplarily, after the transaction executor completes the processing of the current pending transaction, the transaction processing result is sent to the transaction coordinator.
[0092] S520, determining the submission time information of the transaction processing result.
[0093] In an optional embodiment, the time information recorded by the target clock system when obtaining the transaction processing result may be used as the submission time information of the transaction processing result.
[0094] In an optional implementation, the transaction processing result is fed back to the client; in response to the transaction commit instruction sent by the client, the second time information of the target clock system at the current moment is obtained; and the second time information is used as the commit time information. Exemplarily, the client will record the transaction processing result, and after recording, issue a transaction commit instruction to instruct the transaction coordinator to submit the processing record of the current pending transaction.
[0095] S530: Use the submission time information as the transaction submission timestamp of the current transaction to be processed.
[0096] In the above embodiment, the transaction submission time information of the current transaction to be processed is recorded to facilitate subsequent query.
[0097] Based on the technical solutions of the above embodiments, the present application also provides an optional embodiment. In this optional embodiment, the distributed transaction timing method provided by the present application is applied to Fig. 6A In the application environment shown, the distributed transaction timing method provided by the present application is introduced in detail.
[0098] See also Fig. 6A In the application environment diagram shown, the client 102 is connected to the transaction coordinator 202 in the distributed storage system 20 , and the transaction coordinator 202 is connected to the transaction executor 204 .
[0099] See also Figure 6B The distributed transaction timing method shown includes:
[0100] S601, the client sends the current pending transaction to the transaction coordinator;
[0101] S602, the transaction coordinator determines the target business system responsible for processing the current transaction to be processed according to the transaction type of the current transaction to be processed;
[0102] S603, the transaction coordinator uses the clock system corresponding to the target business system as the target clock system corresponding to the current transaction to be processed;
[0103] S604, the transaction coordinator receives the first time information of the target clock system at the current moment;
[0104] S605, the transaction coordinator uses the first time information as the transaction start timestamp of the current transaction to be processed;
[0105] S606, the transaction coordinator sends the transaction processing instruction corresponding to the current pending transaction to the transaction executor;
[0106] The transaction processing instruction carries the current pending transaction and the transaction start timestamp of the current pending transaction;
[0107] S607, the transaction executor receives the transaction processing instruction and processes the current pending transaction;
[0108] S608, the transaction executor feeds back the transaction processing result corresponding to the current pending transaction to the transaction coordinator;
[0109] S609, the transaction coordinator feeds back the transaction processing result to the client;
[0110] S610, the transaction coordinator receives the transaction commit instruction fed back by the client;
[0111] S611, the transaction coordinator obtains the second time information of the target clock system at the current time in response to the transaction commit instruction sent by the client;
[0112] S612: The transaction coordinator uses the second time information as a transaction submission timestamp of the current transaction to be processed.
[0113] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned 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 does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can 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 to be 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.
[0114] Based on the same inventive concept, the embodiment of the present application also provides a distributed transaction timing device for implementing the above-mentioned distributed transaction timing method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in the one or more distributed transaction timing device embodiments provided below can refer to the limitations of the distributed transaction timing method above, and will not be repeated here.
[0115] In an exemplary embodiment, Figure 7 As shown, a distributed transaction timing device is provided, including: a transaction receiving module 710, a clock system determination module 720 and a timing module 730, wherein:
[0116] The transaction receiving module 710 is used to receive the current pending transaction sent by the client;
[0117] The clock system determination module 720 is used to determine the target clock system corresponding to the current pending transaction according to the transaction attributes of the current pending transaction; wherein the transaction attributes include the transaction type;
[0118] The timing module 730 is used to provide timing for the current transaction to be processed based on the target clock system.
[0119] In one embodiment, the clock system determination module 720 includes a business system determination unit, which is used to determine the target business system responsible for processing the current transaction to be processed based on the transaction attributes of the current transaction to be processed; wherein the distributed storage system includes at least two business systems and at least one clock system; the clock systems corresponding to at least some business systems are different; there is no transaction interaction between different business systems; the clock system determination unit is used to use the clock system corresponding to the target business system as the target clock system corresponding to the current transaction to be processed.
[0120] In one embodiment, the timing module 730 is used to use the first time information of the target clock system at the current moment as the transaction start timestamp of the current pending transaction; accordingly, the distributed transaction timing device also includes an instruction sending module, which is used to send the transaction processing instruction corresponding to the current pending transaction to the transaction executor to instruct the transaction executor to process the current pending transaction; wherein, the distributed storage system includes the transaction executor; the transaction processing instruction carries the current pending transaction and the transaction start timestamp of the current pending transaction.
[0121] In one embodiment, the timing module includes a result acquisition unit, which is used to obtain the transaction processing result fed back by the transaction executor; a first determination unit, which is used to determine the submission time information of the transaction processing result; and a second determination unit, which is used to use the submission time information as the transaction submission timestamp of the current transaction to be processed.
[0122] In one embodiment, the first determination unit includes a result feedback subunit, which is used to feed back the transaction processing result to the client; an acquisition subunit, which is used to respond to the transaction submission instruction sent by the client and obtain the second time information of the target clock system at the current moment; and a determination subunit, which is used to use the second time information as the submission time information.
[0123] Each module in the above-mentioned distributed transaction timing device 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 the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0124] 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 8As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through 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, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a distributed transaction timing method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0125] Those skilled in the art will understand that Figure 8 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.
[0126] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0127] Receive the current pending transaction sent by the client;
[0128] Determine the target clock system corresponding to the current pending transaction according to the transaction attributes of the current pending transaction; wherein the transaction attributes include the transaction type;
[0129] Based on the target clock system, the time for the current pending transaction is synchronized.
[0130] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0131] According to the transaction attributes of the current pending transaction, determine the target business system responsible for processing the current pending transaction; wherein the distributed storage system includes at least two business systems and at least one clock system; at least some of the business systems correspond to different clock systems; and there is no transaction interaction between different business systems;
[0132] The clock system corresponding to the target business system is used as the target clock system corresponding to the current transaction to be processed.
[0133] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0134] The first time information of the target clock system at the current moment is used as the transaction start timestamp of the current transaction to be processed;
[0135] Sending a transaction processing instruction corresponding to the current pending transaction to the transaction executor to instruct the transaction executor to process the current pending transaction;
[0136] The distributed storage system includes a transaction executor; the transaction processing instruction carries the current pending transaction and the transaction start timestamp of the current pending transaction.
[0137] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0138] Obtain the transaction processing results fed back by the transaction executor;
[0139] Determine the submission time information of the transaction processing results;
[0140] The commit time information is used as the transaction commit timestamp of the current pending transaction.
[0141] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0142] Feedback transaction processing results to the client;
[0143] In response to the transaction commit instruction sent by the client, obtain the second time information of the target clock system at the current time;
[0144] The second time information is used as the submission time information.
[0145] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0146] Receive the current pending transaction sent by the client;
[0147] Determine the target clock system corresponding to the current pending transaction according to the transaction attributes of the current pending transaction; wherein the transaction attributes include the transaction type;
[0148] Based on the target clock system, the time for the current pending transaction is synchronized.
[0149] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0150] According to the transaction attributes of the current pending transaction, determine the target business system responsible for processing the current pending transaction; wherein the distributed storage system includes at least two business systems and at least one clock system; at least some of the business systems correspond to different clock systems; and there is no transaction interaction between different business systems;
[0151] The clock system corresponding to the target business system is used as the target clock system corresponding to the current transaction to be processed.
[0152] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0153] The first time information of the target clock system at the current moment is used as the transaction start timestamp of the current transaction to be processed;
[0154] Sending a transaction processing instruction corresponding to the current pending transaction to the transaction executor to instruct the transaction executor to process the current pending transaction;
[0155] The distributed storage system includes a transaction executor; the transaction processing instruction carries the current pending transaction and the transaction start timestamp of the current pending transaction.
[0156] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0157] Obtain the transaction processing results fed back by the transaction executor;
[0158] Determine the submission time information of the transaction processing results;
[0159] The commit time information is used as the transaction commit timestamp of the current pending transaction.
[0160] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0161] Feedback transaction processing results to the client;
[0162] In response to the transaction commit instruction sent by the client, obtain the second time information of the target clock system at the current time;
[0163] The second time information is used as the submission time information.
[0164] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0165] Receive the current pending transaction sent by the client;
[0166] Determine the target clock system corresponding to the current pending transaction according to the transaction attributes of the current pending transaction; wherein the transaction attributes include the transaction type;
[0167] Based on the target clock system, the time for the current pending transaction is synchronized.
[0168] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0169] According to the transaction attributes of the current pending transaction, determine the target business system responsible for processing the current pending transaction; wherein the distributed storage system includes at least two business systems and at least one clock system; at least some of the business systems correspond to different clock systems; and there is no transaction interaction between different business systems;
[0170] The clock system corresponding to the target business system is used as the target clock system corresponding to the current transaction to be processed.
[0171] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0172] The first time information of the target clock system at the current moment is used as the transaction start timestamp of the current transaction to be processed;
[0173] Sending a transaction processing instruction corresponding to the current pending transaction to the transaction executor to instruct the transaction executor to process the current pending transaction;
[0174] The distributed storage system includes a transaction executor; the transaction processing instruction carries the current pending transaction and the transaction start timestamp of the current pending transaction.
[0175] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0176] Obtain the transaction processing results fed back by the transaction executor;
[0177] Determine the submission time information of the transaction processing results;
[0178] The commit time information is used as the transaction commit timestamp of the current pending transaction.
[0179] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0180] Feedback transaction processing results to the client;
[0181] In response to the transaction commit instruction sent by the client, obtain the second time information of the target clock system at the current time;
[0182] The second time information is used as the submission time information.
[0183] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0184] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method 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 the present application can include at least one of non-volatile memory 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), magnetic 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, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0185] 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 application.
[0186] 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 transaction coordinator in a distributed storage system, the method comprises: Receive the current pending transaction sent by the client; Determine the target clock system corresponding to the current pending transaction according to the transaction attribute of the current pending transaction; wherein the transaction attribute includes a transaction type; Based on the target clock system, time is provided for the current transaction to be processed.
2. The method according to claim 1, characterized in that The determining, according to the transaction attribute of the current transaction to be processed, a target clock system corresponding to the current transaction to be processed includes: Determine the target business system responsible for processing the current transaction to be processed according to the transaction attribute of the current transaction to be processed; wherein the distributed storage system includes at least two business systems and at least one clock system; at least some of the business systems correspond to different clock systems; The clock system corresponding to the target business system is used as the target clock system corresponding to the current transaction to be processed.
3. The method according to claim 2, characterized in that There is no transaction interaction between different business systems.
4. The method according to any one of claims 1 to 3, characterized in that The step of providing time for the current transaction to be processed based on the target clock system includes: Using the first time information of the target clock system at the current moment as the transaction start timestamp of the current transaction to be processed; Accordingly, after timing the current transaction to be processed based on the target clock system, the method further includes: Sending a transaction processing instruction corresponding to the current pending transaction to a transaction executor to instruct the transaction executor to process the current pending transaction; The distributed storage system includes a transaction executor; the transaction processing instruction carries the current transaction to be processed and a transaction start timestamp of the current transaction to be processed.
5. The method according to claim 4, characterized in that The method further comprises: Obtaining the transaction processing result fed back by the transaction executor; Determine the submission time information of the transaction processing result; The commit time information is used as the transaction commit timestamp of the current transaction to be processed.
6. The method according to claim 5, characterized in that The determination of the submission time information of the transaction processing result includes: Feedback the transaction processing result to the client; In response to the transaction commit instruction sent by the client, obtaining second time information of the target clock system at the current moment; The second time information is used as the submission time information.
7. A distributed transaction timing device, characterized in that: The device comprises: The transaction receiving module is used to receive the current pending transaction sent by the client; A clock system determination module, configured to determine a target clock system corresponding to the current pending transaction according to a transaction attribute of the current pending transaction; wherein the transaction attribute includes a transaction type; A timing module is used to provide timing for the current transaction to be processed based on the target clock system.
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.