Efficient database active transaction registration method and system

By creating an independent active transaction registration list for each process and starting an active transaction summary process, the synchronization operation problem of traditional databases when operating an active transaction chain is solved, and the system's transaction processing throughput and resource utilization is significantly improved.

CN120067101APending Publication Date: 2025-05-30JIANGSU HUAKU DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510049575.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

Traditional MVCC databases have synchronous operations when operating active transaction chains, resulting in severe performance losses, especially when multiple transactions are registered or cancelled, and may even lead to system unavailability.

Method used

By creating an independent active transaction registration list for each process and starting the active transaction summary process, periodically obtaining transaction information from the linked list, summarizing it into an active transaction tree, generating snapshots and passing it to the recycling process, avoiding locking operations on the global data structure.

Benefits of technology

It significantly reduces resource competition during transaction registration and cancellation, improves the system's transaction processing throughput, supports large-scale concurrent transaction management, simplifies transaction state query, reduces the time complexity of transaction state maintenance, and optimizes system resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067101A_ABST
    Figure CN120067101A_ABST
Patent Text Reader

Abstract

The invention discloses an efficient database active transaction registration method and system, and the method comprises the steps: creating an independent active transaction registration chain table for each process, limiting the registration and logout operation of transactions in a local chain table, and avoiding the global lock contention; the method comprises the following steps: periodically acquiring active transaction information from a linked list of each process through an active transaction summarization process, and summarizing and managing by constructing an active transaction tree, so as to generate an active transaction snapshot; the recovery process judges the recovery condition of the data version by using the active transaction snapshot, and de-references the snapshot to release resources after the recovery operation is completed; according to the method, by adopting the lock-free design, the efficiency of transaction registration, logout and version recovery is remarkably improved, the resource utilization rate and the concurrency performance of the system are optimized, and the method has excellent expansibility and adaptability and is suitable for transaction management and optimization of the multi-version concurrency control database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database transaction processing, and in particular, to an efficient method and system for registering active transactions in a database. Background Art

[0002] MVCC (Multi-Version Concurrency Control) is a concurrency control mechanism widely used in database systems. Especially in databases that support high-concurrency transactions, it can help achieve data consistency and isolation when multiple transactions are executed in parallel. The basic idea of MVCC is to maintain multiple versions of data, enabling multiple transactions to read and write data simultaneously without interfering with each other, thereby improving concurrency and system throughput. Among them, in MVCC (Multi-Version Concurrency Control), the Active Transaction Chain is a special data structure used to track the transactions that are still active (i.e., not yet committed or rolled back) in the current system. It plays a key role in implementing efficient concurrency control and transaction isolation, especially when dealing with multiple transactions accessing the same data. In addition, in MVCC, historical versions of data may occupy a large amount of storage space. Therefore, the database needs to periodically clean up these data versions that are no longer needed.

[0003] Currently, there are three scenarios for operating the active transaction chain in a traditional MVCC database: active transaction registration, active transaction cancellation, and active transaction search (mainly during the version recovery process). In all three scenarios, a lock is added first, then the active transaction chain is operated, and then the lock is released. When any transaction or thread operates the active transaction chain, other transactions or processes need to wait. In other words, their operations on the active transaction chain are synchronous. Such an operation method results in a very large performance loss. When there are multiple active transactions to be registered or cancelled, or when a large number of versions need to be recovered and the active transaction chain needs to be frequently retrieved, the blocking is very serious, even to the point of making the system unavailable. Summary of the Invention

[0004] The purpose of this part is to outline some aspects of the embodiments of the present invention and briefly introduce some preferred embodiments. Simplifications or omissions may be made in this part, as well as in the abstract and title of the present application, to avoid obscuring the purpose of this part, the abstract, and the title. However, such simplifications or omissions shall not be used to limit the scope of the present invention.

[0005] In view of the above existing problems, the present invention is proposed. Therefore, the present invention provides an efficient method for registering active transactions in a database to solve the problems mentioned in the background art.

[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0007] In a first aspect, the present invention provides an efficient database active transaction registration method, comprising:

[0008] Acquire multiple processes, create an independent active transaction registration linked list for each process, record the registration and deregistration of all active transactions under the current process in the active transaction registration linked list, and simultaneously start the active transaction summary process to obtain the registration information and deregistration information of active transactions from the active transaction registration linked list on a periodic basis;

[0009] The registration information and deregistration information are aggregated through the active transaction aggregation process, recorded in its own active transaction tree, and an active transaction snapshot is generated according to the active transaction tree and passed to the recovery process;

[0010] The recycling process refers to the summary process, uses the latest active transaction snapshot as a basis for judgment, and releases the used active transaction snapshot after completing the recycling operation, to ensure that resources are correctly recycled and managed.

[0011] As a preferred solution of the efficient database active transaction registration method of the present invention, wherein: the independent active transaction registration linked list includes:

[0012] The independent active transaction registration linked list is composed of a plurality of active transaction registration linked list nodes, and each current active transaction registration linked list node includes a read timestamp of the active transaction, a registration event identifier, and a next active transaction registration linked list node.

[0013] As a preferred solution of the efficient database active transaction registration method of the present invention, the registration and deregistration of all active transactions under the current process are recorded in the active transaction registration linked list, including:

[0014] When an active transaction is registered or deregistered, only a node is added to the active transaction registration list of the process in which it is located, and then the read timestamp in the registered node is obtained from the global read timestamp distributor;

[0015] During the active transaction registration process, a unique read timestamp is assigned to the active transaction through a global read timestamp assignor, and a record is added to the end of the active transaction registration linked list of the current process through the active transaction. The additional record includes the global read timestamp assignor id and the current state action=1, where 1 indicates the registration state;

[0016] Update the end position of the active transaction registration list of the current process;

[0017] After the registration of active transactions is completed, an active transaction cancellation process is executed. During the active transaction cancellation process, a record is appended to the end of the active transaction registration linked list of the current process. The appended record includes the global read timestamp allocator ID and the current status action = -1, where -1 indicates the cancellation status.

[0018] As a preferred solution of the efficient database active transaction registration method described in the present invention, the following steps are included: Start an active transaction summary process. Based on a cycle, obtain the registration information and cancellation information of active transactions from the active transaction registration linked list, including:

[0019] By querying the global read timestamp allocator, obtain the current latest read timestamp, and view the active transaction registration linked list of each process. Cut the nodes before the last node of each active transaction registration linked list.

[0020] During the cutting process, only cut the content therein and retain the last node. Record the read timestamp of the global read timestamp allocator that performs the cutting operation as -1.

[0021] As a preferred solution of the efficient database active transaction registration method described in the present invention, the following steps are included: Through the active transaction summary process, summarize the registration information and cancellation information, record them in its own active transaction tree, and generate an active transaction snapshot based on the active transaction tree, including:

[0022] When the summary process receives a node, add up the current status actions of the nodes with the same read timestamp. If the added current status action = 0, it means that the active transaction has been cancelled and no record is made. If it is not 0, record it on the active transaction tree.

[0023] The active transaction snapshot uses the latest read timestamp to overwrite the current maximum read timestamp.

[0024] As a preferred solution of the efficient database active transaction registration method described in the present invention, the following steps are included: The recycling process references the summary process, uses the latest active transaction snapshot as the judgment basis, and releases the used active transaction snapshot after completing the recycling operation to ensure that resources are correctly recycled and managed, including:

[0025] Record all currently counted active transactions through an active transaction chain and sort them in ascending order of read timestamp.

[0026] If the latest read timestamp cannot overwrite the current maximum read timestamp, that is, the value of the current active transaction is greater than the maximum read timestamp, the recycling process does not recycle the data version greater than the maximum read timestamp.

[0027] In a second aspect, the present invention provides an efficient database active transaction registration system, which includes:

[0028] An active transaction management module, configured to obtain multiple processes, create an independent active transaction registration linked list for each process, record the registration and cancellation of all active transactions under the current process on the active transaction registration linked list, and at the same time start an active transaction summarization process to obtain the registration information and cancellation information of active transactions from the active transaction registration linked list on a periodic basis;

[0029] An active transaction summarization module, configured to summarize the registration information and cancellation information through the active transaction summarization process, record them in its own active transaction tree, and generate an active transaction snapshot according to the active transaction tree and transfer it to the recycling process;

[0030] A version recycling module, configured to have the recycling process reference the summarization process, use the latest active transaction snapshot as a judgment basis, and release the used active transaction snapshot after completing the recycling operation to ensure that resources are correctly recycled and managed.

[0031] In a third aspect, the present invention provides a computer device, including a memory and a processor, where the memory stores a computer program, and: when the processor executes the computer program, any step of the above method is implemented.

[0032] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and: when the computer program is executed by a processor, any step of the above method is implemented.

[0033] Compared with the prior art, the beneficial effects of the invention are:

[0034] 1. By independently creating an active transaction registration linked list for each process, the locking operation on the global data structure is avoided, and resource contention during the transaction registration and cancellation process is significantly reduced; compared with the traditional synchronization mechanism, the new solution improves the transaction processing throughput of the system and can efficiently support the management of large-scale concurrent transactions;

[0035] 2. The designed active transaction summarization process periodically extracts transaction information from the independent linked list and stores it in the form of an active transaction tree by combining the registration and cancellation information. This not only realizes the efficient management of transaction states but also simplifies the complexity of transaction state query. Compared with the traditional method of directly traversing the linked list, the time complexity of transaction state maintenance is significantly reduced;

[0036] 3. By generating sorted snapshots of active transactions, the version recycling process avoids real-time operations on the transaction list, greatly shortening the retrieval time for recycling judgment. Relying on the transaction status information in the snapshot, the accuracy and real-time performance of the recycling process are taken into account, ensuring that expired data versions can be released quickly, thereby optimizing system resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:

[0038] Figure 1 The overall flow chart of an efficient database active transaction registration method according to an embodiment of the present invention;

[0039] Figure 2 A data structure diagram of an active transaction registration linked list of an efficient database active transaction registration method according to an embodiment of the present invention;

[0040] Figure 3 A schematic diagram of active transaction registration and deregistration of an efficient database active transaction registration method according to an embodiment of the present invention;

[0041] Figure 4 A schematic diagram of collecting active transactions of an efficient database active transaction registration method according to an embodiment of the present invention;

[0042] Figure 5 A process diagram of cutting and copying nodes in an active transaction list of an efficient database active transaction registration method according to an embodiment of the present invention;

[0043] Figure 6 An active transaction summary and snapshot generation diagram of an efficient database active transaction registration method according to an embodiment of the present invention;

[0044] Figure 7 A schematic diagram of an active transaction tree of an efficient database active transaction registration method according to an embodiment of the present invention;

[0045] Figure 8 An event diagram for processing registration and deregistration of a summary process of an efficient database active transaction registration method according to an embodiment of the present invention;

[0046] Figure 9 A schematic diagram of an adjusted active transaction tree of an efficient database active transaction registration method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0047] To make the above objects, features, and advantages of the present invention more apparent and understandable, the following provides a detailed description of the specific embodiments of the present invention in conjunction with the accompanying drawings of the specification. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of the present invention.

[0048] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Those skilled in the art can make similar generalizations without departing from the spirit of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed below.

[0049] Secondly, the so-called "one embodiment" or "embodiment" herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation manner of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it an embodiment that is separate or selectively exclusive of other embodiments.

[0050] The present invention is described in detail in conjunction with schematic diagrams. When detailing the embodiments of the present invention, for ease of explanation, the cross-sectional views showing the device structure will be enlarged locally out of the general scale, and the schematic diagrams are only examples and should not limit the scope of protection of the present invention herein. In addition, in actual production, three-dimensional spatial dimensions including length, width, and depth should be included.

[0051] At the same time, in the description of the present invention, it should be noted that the orientation or positional relationships indicated by terms such as "upper, lower, inner, and outer" are based on the orientation or positional relationships shown in the drawings. This is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation of the present invention. In addition, the terms "first, second, or third" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance.

[0052] Unless otherwise clearly defined and limited in the present invention, the terms "installed, connected, and coupled" shall be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or an integral connection; it may also be a mechanical connection, an electrical connection, or a direct connection, or may be indirectly connected through an intermediate medium, or may be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0053] Embodiment 1

[0054] Refer to Figures 1 to 9, which is the first embodiment of the present invention. This embodiment provides an efficient method for registering active transactions in a database, including:

[0055] S1. Obtain multiple processes, create an independent active transaction registration linked list for each process, record the registration and cancellation of all active transactions under the current process on the active transaction registration linked list, and at the same time start an active transaction summary process to obtain the registration information and cancellation information of active transactions from the active transaction registration linked list on a periodic basis;

[0056] Specifically, refer to Figure 2 , the independent active transaction registration linked list (ActiveTxRegisterChain) is composed of multiple active transaction registration linked list nodes (AtvRegNode), and each current active transaction registration linked list node contains the read timestamp (ts_read) of the active transaction, the registration event identifier (i.e., the current state action), and the next active transaction registration linked list node (Next);

[0057] It should be noted that when an active transaction is registered or cancelled, only append a node to the active transaction registration linked list of its corresponding process (i.e., a transaction may start running on process 1 but is switched to process 2 and ends midway, so the registration event will be recorded on the ActiveTxRegisterChain of process 1, and the cancellation event will be recorded on the ActiveTxRegisterChain of process 2), and then obtain the read timestamp in the registration node from the global read timestamp allocator;

[0058] It should be noted that when an active transaction is registered, the allocated read timestamp is globally unique and in an increasing state, and the increasing state can be achieved through atomic addition;

[0059] Furthermore, during the registration process of active transactions, a unique read timestamp is allocated to the active transaction through the global read timestamp allocator, and a record is appended to the end of the active transaction registration linked list of the current process for the active transaction. The appended record contains the global read timestamp allocator id and the current state action = 1, where 1 represents the registration state;

[0060] Even further, update the end position of the active transaction registration linked list of the current process;

[0061] It should be noted that since only records are added to the end of the active transaction registration linked list of the current process, there is no contention from other processes at this time, so no locking is required;

[0062] Further, after the registration of active transactions is completed, the process of canceling active transactions is executed. During the process of canceling active transactions, a record is appended to the end of the active transaction registration linked list of the current process. The appended record contains the global read timestamp allocator ID and the current state action=-1, where -1 indicates the cancellation state;

[0063] Exemplarily, take Figure 3 as an example. There have been 4 registrations and cancellations on Process 1, which are respectively:

[0064] Registration of an active transaction with ts_read=1;

[0065] Registration of an active transaction with ts_read=2;

[0066] Registration of an active transaction with ts_read=3;

[0067] Registration of an active transaction with ts_read=4;

[0068] And there have been 4 registrations and cancellations on Process 2, which are respectively:

[0069] Cancellation of an active transaction with ts_read=1 (this active transaction was previously registered on Process 1, scheduled to Process 2 during operation, and finally ended on Process 2);

[0070] Cancellation of an active transaction with ts_read=3;

[0071] Registration of an active transaction with ts_read=5;

[0072] Registration of an active transaction with ts_read=6;

[0073] It should be noted that each process has its own independent active transaction registration linked list. A transaction will only run on one process at a time and will not run on multiple processes simultaneously. When registering an active transaction, it is registered on the active transaction registration linked list of the process where it is located. The above example illustrates the effectiveness of active transaction registration and cancellation in the solution of the present invention;

[0074] Further, referring to Figure 4 , by querying the global read timestamp allocator, the current latest read timestamp is obtained, and the active transaction registration linked list of each process is viewed, and the nodes before the last node of each active transaction registration linked list are cut;

[0075] Even further, referring to Figure 5 , during the cutting process, only the content therein is cut, and the last node (Tail) is retained, and the read timestamp of the global read timestamp allocator that performs the cutting operation is recorded as -1;

[0076] It should be noted that the read timestamp of the global read timestamp allocator that performs the cut operation is marked as -1 to identify that this node has been collected, avoiding repeated collection in the next cycle. The purpose of retaining this node is not to affect the registration of other active transactions, and other active transaction nodes can still be appended after this node. Moreover, neither the cut nor the copy operation here requires locking (it will not affect the registration and cancellation of new active transactions).

[0077] S2. Through the active transaction summary process, summarize the registration information and cancellation information, record them in its own active transaction tree, and generate an active transaction snapshot based on the active transaction tree, and transfer it to the recycling process;

[0078] Furthermore, referring to Figure 6 , when the summary process receives a node, sum up the current status actions of the nodes with the same read timestamp. If the sum of the current status actions after summing is 0, it means that this active transaction has been cancelled and no record is made. If it is not 0, record it on the active transaction tree;

[0079] Preferably, the active transaction tree adopts a red-black tree. The red-black tree is a binary balanced tree, and the efficiency of insertion, deletion, and retrieval is very high, which is convenient for recording active transactions;

[0080] Exemplarily, there is an active transaction tree as follows, referring to Figure 7 ; when the summary process processes the following two new events (referring to Figure 8 ): one is the registration of an active transaction with ts_read = 7, and the other is the cancellation of an active transaction with ts_read = 10; then this active transaction tree Figure 7 will be adjusted to Figure 9 ; from Figure 9 it can be seen that the node with ts_read = 7 will be used as the left child node of ts_read = 6, and the node with ts_read = 10 will be deleted from the tree because the sum of actions = 0;

[0081] It should be noted that the active transaction snapshot uses the latest read timestamp to overwrite the current maximum read timestamp;

[0082] S3. The recycling process references the summary process, uses the latest active transaction snapshot as the judgment basis, and releases the used active transaction snapshot after completing the recycling operation to ensure that resources are correctly recycled and managed;

[0083] Furthermore, record all currently counted active transactions through the active transaction chain, and sort them in ascending order of the read timestamp;

[0084] Further, if the latest read timestamp cannot cover the current maximum read timestamp, that is, the value of the current active transaction is greater than the maximum read timestamp, the recycling process does not recycle the data version greater than the maximum read timestamp;

[0085] It should be noted that other processes ( Figure 6 Process 1 and Process 2 in it) are still registering and canceling active transactions. They not only successfully remove the locks on the active transaction chain, but also solve the problem of low efficiency in retrieving the active transaction chain through the red-black tree.

[0086] Further, this embodiment also provides an efficient database active transaction registration system, including:

[0087] An active transaction management module, configured to obtain multiple processes, create an independent active transaction registration linked list for each process, record the registration and cancellation of all active transactions under the current process on the active transaction registration linked list, and at the same time start an active transaction summarization process to obtain the registration information and cancellation information of active transactions from the active transaction registration linked list on a periodic basis;

[0088] An active transaction summarization module, configured to summarize the registration information and cancellation information through the active transaction summarization process, record them in its own active transaction tree, and generate an active transaction snapshot according to the active transaction tree and transfer it to the recycling process;

[0089] A version recycling module, configured to have the recycling process reference the summarization process, use the latest active transaction snapshot as a judgment basis, and release the used active transaction snapshot after completing the recycling operation to ensure that resources are correctly recycled and managed.

[0090] This embodiment also provides a computer device applicable to the case of an efficient database active transaction registration method, including:

[0091] A memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the efficient database active transaction registration method proposed in the above embodiment.

[0092] The computer device may be a terminal, which includes a processor, a memory, a communication interface, a display screen, and an input device connected via a system bus. Among them, 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 computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner, and the wireless manner can be achieved through WIFI, carrier network, NFC (Near Field Communication), or other technologies. The display screen of the computer device 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 provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.

[0093] This embodiment also provides a storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the efficient database active transaction registration method proposed in the above embodiment.

[0094] The storage medium proposed in this embodiment and the data storage method proposed in the above embodiment belong to the same inventive concept. Technical details not described in detail in this embodiment can be referred to in the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0095] Embodiment 2

[0096] Referring to Table 1 and Table 2, this is the second embodiment of the present invention. This embodiment provides an efficient database active transaction registration method, including: through simulation experiments, performing performance tests on the solution of the present invention in ultra-short transaction scenarios and congestion scenarios to verify the beneficial effects of the solution of the present invention;

[0097] Referring to Table 1 and Table 2, as follows:

[0098] Table 1 Performance test in ultra-short transaction scenario

[0099]

[0100] As can be seen from Table 1, with 12 CPUs and 12 processes measured, and each process performing 100,000 registrations and cancellations, in the ultra-short transaction scenario (the transaction ends immediately after it starts, that is, cancels immediately after registration), the execution time of the traditional method is 1.89755 seconds, and the execution time of the present invention is 0.02955 seconds, with the efficiency increased by 64.21 times;

[0101] Table 2 Performance test in congestion scenario

[0102]

[0103] As can be seen from Table 2, when measuring 12 CPUs and 12 processes, with each process performing 100,000 registrations and cancellations, in the congestion scenario (where all transactions are registered first and then cancelled), the traditional method cannot be completed within 25 minutes (the actual execution time will be much longer than this), while the execution time of the present invention is 1.63 seconds, and the performance is improved by at least 937 times, and may even be thousands of times;

[0104] Through the performance tests shown in Table 1 and Table 2, it can be seen that the solution of the present invention can have ultra-high performance in ultra-short transaction scenarios and congestion scenarios, thus demonstrating the feasibility of the solution of the present invention and the improvement in system performance brought about.

[0105] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The solutions in the embodiments of the present application can be implemented in various computer languages. For example, object-oriented programming languages such as Java and interpreted scripting languages such as JavaScript.

[0106] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.

[0107] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means implements the functions specified in Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.

[0108] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are performed on the computer or other programmable apparatus to produce a computer-implemented process, and thus the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one process or a plurality of processes and / or blocks Figure 1 one process or a plurality of processes and / or blocks Figure 1 or steps for implementing the functions specified in one block or a plurality of blocks.

[0109] Although the preferred embodiments of the present application have been described, additional changes and modifications can be made to these embodiments by those skilled in the art once they learn the basic creative concept. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications that fall within the scope of the present application.

[0110] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.

Claims

1. An efficient database active transaction registration method, characterized in that: include: Acquire multiple processes, create an independent active transaction registration linked list for each process, record the registration and deregistration of all active transactions under the current process in the active transaction registration linked list, and simultaneously start the active transaction summary process to obtain the registration information and deregistration information of active transactions from the active transaction registration linked list on a periodic basis; The registration information and deregistration information are aggregated through the active transaction aggregation process, recorded in its own active transaction tree, and an active transaction snapshot is generated according to the active transaction tree and passed to the recovery process; The recycling process refers to the summary process, uses the latest active transaction snapshot as a basis for judgment, and releases the used active transaction snapshot after completing the recycling operation, to ensure that resources are correctly recycled and managed.

2. The efficient database active transaction registration method according to claim 1, characterized in that: The independent active transaction registration list includes: The independent active transaction registration linked list is composed of a plurality of active transaction registration linked list nodes, and each current active transaction registration linked list node includes a read timestamp of the active transaction, a registration event identifier, and a next active transaction registration linked list node.

3. The efficient database active transaction registration method according to claim 1, characterized in that: The registration and deregistration of all active transactions under the current process are recorded in the active transaction registration linked list, including: When an active transaction is registered or deregistered, only a node is added to the active transaction registration list of the process in which it is located, and then the read timestamp in the registered node is obtained from the global read timestamp distributor; During the active transaction registration process, a unique read timestamp is assigned to the active transaction through a global read timestamp assignor, and a record is added to the end of the active transaction registration linked list of the current process through the active transaction. The additional record includes the global read timestamp assignor id and the current state action=1, where 1 indicates the registration state; Update the end position of the active transaction registration list of the current process; When the active transaction registration is completed, the active transaction deregistration process is executed. In the active transaction deregistration process, a record is added to the end of the active transaction registration linked list of the current process. The additional record contains the global read timestamp assignor id and the current state action=-1, where -1 indicates the deregistration state.

4. The efficient database active transaction registration method as claimed in claim 3, characterized in that: The active transaction aggregation process is started, and the registration information and deregistration information of the active transactions are obtained from the active transaction registration linked list on a periodic basis, including: By querying the global read timestamp distributor, the latest read timestamp is obtained, and the active transaction registration list of each process is checked, and the nodes before the end node of each active transaction registration list are cut; During the cutting process, only the content is cut and the end node is retained, and the read timestamp of the global read timestamp distributor that performs the cutting operation is recorded as -1.

5. The efficient database active transaction registration method according to claim 4, characterized in that: The registration information and deregistration information are aggregated through the active transaction aggregation process, recorded in its own active transaction tree, and an active transaction snapshot is generated according to the active transaction tree, including: When the aggregation process receives the node, it sums up the current state action of the nodes with the same reading timestamp. If the summed current state action=0, it means that the active transaction has been cancelled and no record is made. If it is not 0, it is recorded in the active transaction tree; The active transaction snapshot uses the latest read timestamp to overwrite the current maximum read timestamp.

6. The efficient database active transaction registration method according to claim 1 or 5, characterized in that: The recycling process refers to the summary process, uses the latest active transaction snapshot as a basis for judgment, and releases the active transaction snapshot after the recycling operation is completed to ensure that resources are correctly recycled and managed, including: Through the active transaction chain, all currently active transactions are recorded and sorted in ascending order according to the read timestamp; If the latest read timestamp cannot cover the current maximum read timestamp, that is, the value of the current active transaction is greater than the maximum read timestamp, the recycling process will not recycle data versions greater than the maximum read timestamp.

7. An efficient database active transaction registration system, based on the efficient database active transaction registration method according to any one of claims 1 to 6, characterized in that: include: The active transaction management module is configured to obtain multiple processes, create an independent active transaction registration chain list for each process, record the registration and deregistration of all active transactions under the current process in the active transaction registration chain list, and start the active transaction summary process to obtain the registration information and deregistration information of the active transactions from the active transaction registration chain list on a periodic basis; An active transaction aggregation module is configured to aggregate the registration information and deregistration information through the active transaction aggregation process, record the information in its own active transaction tree, and generate an active transaction snapshot based on the active transaction tree, and pass the snapshot to the recovery process; The version recycling module is configured to reference the summary process in the recycling process, use the latest active transaction snapshot as a basis for judgment, and release the used active transaction snapshot after completing the recycling operation to ensure that resources are correctly recycled and managed.

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.