Writing method of process transaction log in database, storage medium and equipment

By allocating process groups and group linked lists to processes in the database, and merging the target linked list nodes with adjacent preallocated storage space of the process, the problem of low writing efficiency of process transaction logs is solved, and efficient writing to the write-pre-log buffer is achieved.

CN120276655APending Publication Date: 2025-07-08CETC JINCANG (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311846943.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-28
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

In the prior art, the writing efficiency of process transaction logs in the database is inefficient, especially when writing transaction log data into the write-ahead log buffer, each process needs to acquire the transaction log insertion lock, resulting in inefficient writing efficiency.

Method used

By allocating a process group to the process and configuring the process group into a group linked list, we can determine whether the process is a follower process, merge the target linked list nodes with adjacent pre-allocated storage space of the process, reduce the number of times of insertion locks being acquired, and improve write efficiency.

Benefits of technology

It realizes that transaction log data of multiple processes can be written to the write-pre-log buffer at the same time, reducing the number of insertion lock acquisitions and improving the efficiency of transaction log copying to the pre-allocated buffer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120276655A_ABST
    Figure CN120276655A_ABST
Patent Text Reader

Abstract

The invention provides a writing method of a process transaction log in a database, a storage medium and equipment. The method comprises the following steps: judging whether a group linked list has a target linked list node or not; wherein the pre-allocated storage space range recorded by the target linked list node is adjacent to the pre-allocated storage space range of the follower process; if the number of the target linked list node is one, merging the follower process into the target linked list node; if the number of the target linked list nodes is two, combining one target linked list node and the follower process into the other target linked list node; or merging the follower process into one of the target linked list nodes; and if not, creating a linked list node on the group linked list for the follower process. When some follower processes are added into the corresponding group linked list, new linked list nodes do not need to be created, and the follower processes are directly added into the existing linked list nodes. The transaction log data of a plurality of processes can be written into the pre-write log buffer area at the same time at a time, and the writing efficiency is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of databases, and in particular, to a method for writing process transaction logs in a database, a storage medium, and a computer device. Background Art

[0002] In a database management system, the XLOG log, also known as the WAL (Write Ahead Log) log, is the transaction log mentioned in traditional database theory, which details the operation process of the service process on the database. To achieve the persistence of the transaction log (XLOG, transaction log), the process transaction log needs to be written into the write-ahead log buffer (WAL, Write Ahead Log) first, so that it is in the write cache, and finally the transaction log in the write cache is written to the disk to achieve log disk write. During the process of copying the transaction log data to the write-ahead log buffer, the process corresponding to the transaction log needs to obtain a transaction log insertion lock to avoid conflicts between processes during the copying process.

[0003] In a database management system, any process that can generate a transaction log needs to go through seven stages when the newly generated transaction log of the process needs to be written to the disk, namely generating transaction log data, registering transaction log data, assembling transaction log data, pre-allocating storage space for the transaction log in the write-ahead log buffer, putting the data of each node of the transaction log assembly linked list into a continuous storage area, copying the transaction log data in the continuous storage area to the write-ahead log buffer of the transaction log, and writing the transaction log cached in the write-ahead log buffer to the disk. When writing the transaction log data into the write-ahead log buffer first, each write to the write-ahead log buffer can only write the transaction log data of one process, and the writing efficiency is relatively low.

[0004] In addition, the three stages of pre-allocating storage space for the transaction log in the write-ahead log buffer, putting the data of each node of the transaction log assembly linked list into a continuous storage area, and copying the transaction log data in the continuous storage area to the write-ahead log buffer of the transaction log all require the protection of the transaction log insertion lock. Moreover, each transaction log needs to obtain a transaction log insertion lock when written, which also results in low efficiency of writing transaction log data. Summary of the Invention

[0005] In view of the above problems, an object of the present invention is to propose a method for writing process transaction logs in a database, a machine-readable storage medium, and a computer device, which can merge processes, that is, can write the transaction log data of multiple processes into the write-ahead log buffer at the same time at one time, with high writing efficiency.

[0006] A further object of the present invention is to reduce the number of times of acquiring insert locks during the transaction log data replication process and improve the efficiency of replicating the transaction log to the pre-allocated write-ahead log buffer.

[0007] Another further object of the present invention is to reduce the time for the leader process to hold the transaction log insert lock and improve the efficiency of replicating the transaction log to the pre-allocated write-ahead log buffer.

[0008] Specifically, the present invention provides a method for writing a process transaction log in a database. The database is configured with at least one process group or creates at least one process group. The process group is configured to accommodate processes that generate transaction log data. The method for writing a process transaction log in the database includes:

[0009] Allocating the process group to the process so that the process can be added to the group linked list of the process group;

[0010] Determining whether the process is a follower process of the process group;

[0011] If so, determining whether there is a target linked list node on the group linked list; where the pre-allocated storage space range recorded by the target linked list node is adjacent to the pre-allocated storage space range of the follower process;

[0012] If there is one target linked list node, merging the follower process into the target linked list node;

[0013] If there are two target linked list nodes, merging one target linked list node and the follower process into the other target linked list node; or merging the follower process into one of the target linked list nodes;

[0014] If there is no target linked list node, creating a linked list node for the follower process on the group linked list.

[0015] Optionally, the method for writing a process transaction log in the database further includes:

[0016] If it is determined that the process is not a follower process, the process is a leader process of the process group;

[0017] The leader process acquires a transaction log insert lock;

[0018] The leader process copies the transaction log data of the leader process to the pre-allocated write-ahead log buffer, and the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node;

[0019] The leader process releases the transaction log insert lock.

[0020] Optionally, before determining whether there is a target linked list node on the group linked list of the process group, it further includes:

[0021] Determine whether there is a linked list node on the group linked list of the process group corresponding to the follower process that has already joined the group linked list;

[0022] If not, create a linked list node on the group linked list for the follower process;

[0023] If so, enter the determination of whether there is a target linked list node on the group linked list of the process group.

[0024] Optionally, the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node, including:

[0025] The leader process obtains the pre-allocated storage space range recorded by the linked list node from the linked list node;

[0026] Based on the pre-allocated storage space range recorded by the linked list node, the leader process copies the transaction log data of one or more of the processes stored in the linked list node to the pre-allocated write-ahead log buffer.

[0027] Optionally, the linked list node stores the process numbers, transaction log data of one or more of the processes, and the start position information and end position information of the pre-allocated storage space range.

[0028] Optionally, before the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node, it further includes:

[0029] The leader process changes the linked list head of the group linked list to obtain a write-linked list and releases the linked list head, and the released linked list head is used to form a new group linked list;

[0030] The leader process releases the linked list lock of the process group so that the new process joins the new group linked list based on the linked list lock; where

[0031] The leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node, including:

[0032] The leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node of the write-linked list.

[0033] Optionally, the leader process copying the transaction log data of the leader process to a pre-allocated write-ahead log buffer, and the leader process copying the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node, includes:

[0034] The leader process copying the transaction log data of the leader process to a pre-allocated write-ahead log buffer;

[0035] The leader process acquiring the linked list lock of the process group, removing the leader process from the group linked list of the process group, and determining whether the group linked list of the process group is empty;

[0036] If not, the leader process copying the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node.

[0037] Optionally, the leader process copying the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node further includes: the leader process waking up all the follower processes in the linked list node;

[0038] The method for writing the process transaction log in the database further includes:

[0039] The follower process circularly checking whether it receives a wake-up signal sent by the leader process;

[0040] If so, the follower process is in a running state;

[0041] If not, the follower process continues to wait and circularly checks whether it receives a wake-up signal sent by the leader process.

[0042] Optionally, each process group is configured with a linked list head and a linked list lock for forming the group linked list of the process group;

[0043] The method for writing the process transaction log in the database further includes:

[0044] Before determining whether the process is a follower process of the process group, enabling the process to acquire the linked list lock corresponding to the process group, so that the process joins the corresponding group linked list based on the acquired linked list lock;

[0045] Enabling the process that has acquired the linked list lock to release the linked list lock corresponding to the process group after joining the corresponding group linked list.

[0046] Optionally, determining whether the process is a follower process of the process group includes:

[0047] After each of the processes acquires the corresponding linked list lock, it checks whether the corresponding group linked list is empty;

[0048] If so, the process is the leader process of the process group; if not, the process is the follower process of the process group.

[0049] The present invention also provides a machine-readable storage medium, on which a machine-executable program is stored. It is characterized in that when the machine-executable program is executed by a processor, the method for writing a process transaction log in any of the above databases is implemented.

[0050] The present invention also provides a computer device, including a memory, a processor, and a machine-executable program stored on the memory and running on the processor. When the processor executes the machine-executable program, the method for writing a process transaction log in any of the above databases is implemented.

[0051] In the method for writing a process transaction log in the database of the present invention, since a process group is first allocated to the process so that the process can be added to the group linked list of the process group. Then it is determined whether the process is a process that needs to be merged with other processes on the group linked list, that is, whether it is a follower process. If the process needs to be merged, the corresponding target linked list node for merging is determined based on whether the pre-allocated storage space range recorded by the target linked list node is adjacent to the pre-allocated storage space range of the follower process. In this way, when some follower processes are added to the corresponding group linked list, they do not need to create new linked list nodes and can directly be added to the existing linked list nodes. After merging, based on the merged linked list nodes, the transaction log data of multiple processes can be written into the write-ahead log buffer at one time, and the writing efficiency is high.

[0052] From the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more clear about the above and other objects, advantages, and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Some specific embodiments of the present invention will be described in detail hereinafter with reference to the accompanying drawings in an exemplary and non-limiting manner. The same reference numerals in the drawings denote the same or similar components or parts. Those skilled in the art should understand that these drawings are not necessarily drawn to scale. In the drawings:

[0054] Figure 1 is a schematic flowchart of a method for writing a process transaction log in a database according to an embodiment of the present invention;

[0055] Figure 2It is a schematic flowchart of a method for writing a process transaction log in a database according to an embodiment of the present invention;

[0056] Figure 3 It is a schematic diagram of a group linked list of a process group according to an embodiment of the present invention;

[0057] Figure 4 It is a schematic diagram of a data structure corresponding to a linked list node of a group linked list of a process group according to an embodiment of the present invention;

[0058] Figure 5 It is a schematic diagram of the merger of follower processes in a group linked list of a process group according to an embodiment of the present invention;

[0059] Figure 6 It is a schematic diagram of creating a linked list node for a follower process according to an embodiment of the present invention;

[0060] Figure 7 It is a schematic relationship diagram between a follower process and a pre-allocated storage space range of a transaction log of a linked list node according to an embodiment of the present invention;

[0061] Figure 8 It is a schematic diagram of merging a follower process into a linked list node according to an embodiment of the present invention;

[0062] Figure 9 It is a schematic relationship diagram between a follower process and a pre-allocated storage space range of a transaction log of a linked list node according to an embodiment of the present invention;

[0063] Figure 10 It is a schematic diagram of merging a follower process into a linked list node according to an embodiment of the present invention;

[0064] Figure 11 It is a schematic relationship diagram between a follower process and a pre-allocated storage space range of a transaction log of a linked list node according to an embodiment of the present invention;

[0065] Figure 12 It is a schematic diagram of merging a follower process into a linked list node according to an embodiment of the present invention;

[0066] Figure 13 It is a schematic diagram of a group linked list of a process group according to an embodiment of the present invention;

[0067] Figure 14 It is a schematic diagram of a log assembly linked list of a process according to an embodiment of the present invention;

[0068] Figure 15 It is a schematic partial flowchart of a method for writing a process transaction log in a database according to an embodiment of the present invention;

[0069] Figure 16 is a schematic flowchart of a process entering a corresponding process group according to an embodiment of the present invention;

[0070] Figure 17 is a schematic flowchart of determining a process type according to an embodiment of the present invention;

[0071] Figure 18 is a schematic partial flowchart of a method for writing a process transaction log in a database according to an embodiment of the present invention;

[0072] Figure 19 is a schematic diagram of a linked list for writing in a process group according to an embodiment of the present invention;

[0073] Figure 20 is a schematic diagram of a machine-readable storage medium according to an embodiment of the present invention;

[0074] Figure 21 is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed implementation manners

[0075] Figure 1 is a schematic flowchart of a method for writing a process transaction log in a database according to an embodiment of the present invention, as Figure 1 shown, and with reference to Figures 2 to 21 , an embodiment of the present invention provides a method for writing a process transaction log in a database. The database is configured with at least one process group, or at least one process group is created, and the process group is configured to accommodate processes that generate transaction log data. Each process group is configured with a linked list head for forming a group linked list of the process group. The group linked list is denoted as group_list. The method for writing a process transaction log in the database includes:

[0076] Step S100, allocate a process group for the process so that the process can be added to the group linked list (denoted as group_liSt) of the process group.

[0077] Step S200, determine whether the process is a follower process of the process group. The purpose is to determine whether the process is a process that needs to be merged in the group linked list. The follower process is denoted as the follower process, or can also be denoted as follower.

[0078] If so, enter step S300. Step S300, determine whether there is a target linked list node on the group linked list of the process group. The pre-allocated storage space range recorded by the target linked list node is adjacent to the pre-allocated storage space range of the follower process. If the process is a follower process, an object for merging it needs to be found on the group linked list, that is, the target linked list node.

[0079] If so, go to step S400. If not, go to step S600.

[0080] Step S400, check whether the target linked list node is one or two.

[0081] Step S510, if the target linked list node is one, merge the follower process into the target linked list node. That is, based on the judgment of whether there is a target linked list node on the group linked list of the process group, if so, and the target linked list node is one, then add the follower process to the target linked list node. In this way, the follower process can be added to the group linked list.

[0082] Step S520, if the target linked list node is two, merge one target linked list node and the follower process into the other target linked list node. That is, based on the judgment of whether there is a target linked list node on the group linked list of the process group, if so, and the target linked list node is two, then merge one target linked list node and the follower process into the other target linked list node, that is, merge the two target linked list nodes and the follower process into one linked list node, and one of the original linked list nodes can be deleted. In this way, the follower process can be added to the group linked list.

[0083] Step S600, create a linked list node for the follower process on the group linked list so that the follower process can be added to the group linked list.

[0084] In this embodiment, a process group is first allocated to the process so that the process can be added to the group linked list of the process group. Then it is judged whether the process is a process that needs to be merged with other processes on the group linked list, that is, whether it is a follower process. If the process needs to be merged, the corresponding target linked list node for merging is determined based on whether the pre-allocated storage space range recorded by the target linked list node is adjacent to the pre-allocated storage space range of the follower process. In this way, when some follower processes are added to the corresponding group linked list, they do not need to create new linked list nodes and can be directly added to the existing linked list nodes. After merging, based on the merged linked list node, the transaction log data of multiple processes can be written into the write-ahead log buffer at the same time, and the writing efficiency is high.

[0085] Furthermore, the follower process to be added to the group linked list can be used to merge two separated linked list nodes into one linked list node, reducing the number of linked list nodes in the group linked list and further improving the writing efficiency of writing to the write-ahead log buffer.

[0086] In some alternative embodiments of the present invention, if the target linked list node is two, merge the follower process into one of the target linked list nodes. In this way, the follower process can be added to the group linked list.

[0087] In some embodiments of the present invention, if there is only one target linked list node, the follower process is merged into the target linked list node. Specifically, the process ID of the follower process is stored in the process ID of the target linked list node, and the transaction log data of the follower process is stored in the transaction log data of the target linked list node. In addition, the pre-allocated storage space range recorded by the target linked list node is updated so that the pre-allocated storage space range recorded by the target linked list node includes the original pre-allocated storage space range and the pre-allocated storage space range of the follower process.

[0088] If there are two target linked list nodes, one target linked list node and the follower process are merged into the other target linked list node. Specifically:

[0089] Based on the earlier created target linked list node, the later created target linked list node and the follower process are merged into the earlier created target linked list node, so as to merge the two target linked list nodes into one linked list node and delete one linked list node. The earlier created target linked list node can be the first linked list node, and the later created target linked list node can be the second linked list node.

[0090] Further, the process ID of the follower process can be stored in the process ID of the first linked list node, and the transaction log data of the follower process can be stored in the transaction log data of the first linked list node.

[0091] The process ID of the second linked list node is stored in the process ID of the first linked list node, and the transaction log data of the second linked list node is stored in the transaction log data of the first linked list node. And

[0092] The pre-allocated storage space range recorded by the first linked list node is updated so that the pre-allocated storage space range recorded by the first linked list node includes the original two pre-allocated storage space ranges and the pre-allocated storage space range of the follower process.

[0093] In some embodiments of the present invention, as Figure 2 shown, before determining whether there is a target linked list node on the group linked list of the process group, the method for writing the process transaction log in the database further includes:

[0094] Step S250, check whether there is a linked list node on the group linked list of the process group corresponding to the follower process that has already been added to the group linked list;

[0095] If not, go to step S600 to create a linked list node for the follower process on the group linked list;

[0096] If so, go to step S300 to determine whether there is a target linked list node on the group linked list of the process group.

[0097] In this embodiment, when the first follower process joins the group linked list, a linked list node needs to be created for the first follower process on the group linked list.

[0098] In some embodiments of the present invention, when there is no linked list node on the group linked list of the process group corresponding to the follower process that has already joined the group linked list, that is to say, it is determined that there is no target linked list node on the group linked list.

[0099] In some embodiments of the present invention, such as Figure 3 and Figure 4 As shown, each linked list node corresponding to a follower process stores the process numbers of one or more corresponding processes, transaction log data, and the start position information and end position information of the pre-allocated storage space range. Further, the linked list node may also store the length of the transaction log data. That is, as Figure 4 As shown, the data structure corresponding to each linked list node corresponding to a follower process includes a process array (proc_array), transaction log data (data), and the start position information (begin_lSn) and end position information (end_lSn) of the pre-allocated storage space range. Further, the linked list node may also store the length (len) of the transaction log data.

[0100] In some embodiments of the present invention, specifically, under the protection of an exclusive lock, the follower process x obtains the pre-allocated storage space of the transaction log (which can be denoted as from begin_lSn_x to end_lSn_x), and assembles the data of each node in the linked list of the corresponding transaction log into a continuous storage area.

[0101] Then, check whether there is a follower process node in the group linked list, that is, determine whether there is a linked list node on the group linked list of the process group corresponding to the follower process that has already joined the group linked list.

[0102] If not, create a linked list node for this process x, store the transaction log data in the continuous storage area corresponding to this process x into data, store the length of data into len, store pid_x (the process number of process x) into the proc_array array, assign begin_lSn_x to begin_lSn, and assign end_lSn_x to end_lSn. Finally, add the node corresponding to this newly added follower process to the group linked list. As Figure 6 shown.

[0103] If there is, check whether the pre-allocated storage space range of the current transaction log is adjacent to the pre-allocated storage space range of the transaction log recorded by the linked list nodes corresponding to other follower processes. For example, the pre-allocated storage space range of the transaction log recorded in the i-th linked list node is from begin_lSn_i to end_lSn_i.

[0104] If yes, merge the pre-allocated storage space range of the current transaction log with the pre-allocated storage space range of the transaction log recorded by other linked list nodes. There are three specific cases:

[0105] 1).begin_lSn_i is equal to end_lSn_x, and the i-1th linked list node does not exist or the i-1th linked list node exists, but end_lSn_(i-1) is not equal to begin_lSn_x, such as Figure 7 As shown, the new range of the i-th linked list node is begin_lSn_x to end_lSn_i. Then, the transaction log data of the current process and the transaction log data of the i-th linked list node are concatenated together in the order of the pre-allocated storage space range, recorded as data_xi, and the new len is recorded as len_xi, as shown in Figure 8 As shown. The current process number is recorded in the proc_array array of this node, and the linked list lock of the process group is released.

[0106] 2).begin_lSn_x is equal to end_lSn_i, and the i+1th linked list node does not exist or the i+1th linked list node exists, but end_lSn_x is not equal to begin_lSn_(i+1), such as Figure 9 As shown, the new range of the i-th linked list node is begin_lSn_i to end_lSn_x. Then, the transaction log data of the current process and the transaction log data of the i-th linked list node are concatenated together in the order of the pre-allocated storage space range, recorded as data_ix, and the new len is recorded as len_ix, as shown in Figure 10 As shown. The current process number is recorded in the proc_array array of this node, and the linked list lock of the process group is released.

[0107] 3).begin_lSn_x is equal to end_lSn_i, the i+1th linked list node exists, and end_lSn_x is equal to begin_lSn_(i+1), such as Figure 11As shown, the new range of the i-th linked list node is from begin_lSn_i to end_lSn_(i + 1). Then, the transaction log data of the current process, the transaction log data of the (i + 1)-th linked list node, and the transaction log data of the i-th linked list node are concatenated together in the order of the pre-allocated storage space range before and after, and replace the data_i in the i-th linked list node, denoted as data_ix(i + 1), and the new len is denoted as len_ix(i + 1). And record all the process IDs stored in the proc_array array of the current process ID and the (i + 1)-th linked list node into the proc_array array of the i-th linked list node, and delete the (i + 1)-th linked list node, as Figure 12 shown, and finally release the linked list lock of the process group.

[0108] Otherwise, create a linked list node for process x, store the XLOG log data in the continuous storage interval of process x into data, store the length of data into len, store pid_x (the process ID of process x) into the proc_array array, assign begin_lSn_x to begin_lSn, and assign end_lSn_x to end_lSn. Add process x to the group linked list, but ensure that in the group linked list, the pre-allocated storage space range values of the transaction logs of each linked list node are arranged in ascending order, as Figure 13 shown, begin_lSn1 < end_lSn1 < begin_lSn2 < end_lSn2 < begin_lSn3 < end_lSn3, and release the linked list lock of the process group.

[0109] In this embodiment, protecting the pre-allocation of storage space for the transaction log of a process with an exclusive lock is the original logic of the database. Since this process is very fast, there is generally no performance problem.

[0110] In this embodiment, one or more pieces of data of adjacent XLOG logs can be stored in the linked list nodes corresponding to the follower processes of each group linked list. When the pre-allocated storage space range of the XLOG log of a follower process is adjacent to the pre-allocated storage space ranges of the XLOG logs recorded in other linked list nodes, no new group linked list node will be created. Instead, the XLOG log of the current follower process will be merged into the linked list node whose pre-allocated storage space range is adjacent to it. In particular, when the pre-allocated storage space range of the XLOG log of a follower process is adjacent to the pre-allocated storage space ranges recorded in the two adjacent linked list nodes before and after it, then the three XLOG log ranges will be merged, and the latter adjacent node will be deleted from the group linked list. The pre-allocated storage space range values of the XLOG logs of the linked list nodes corresponding to each follower process are arranged in ascending order. After the XLOG log data in the linked list node corresponding to each follower process is copied to the WAL BUFFER, all the follower processes (recorded in the proc_array array) to which the XLOG log of this node belongs will be woken up.

[0111] In some embodiments of the present invention, process x (denoted by its process ID pid_x) generates transaction logs, registers transaction logs, and assembles transaction logs, and then obtains a log assembly linked list, as Figure 14 shown. Each node of the log assembly linked list stores data of different parts of the transaction log.

[0112] In some embodiments of the present invention, as Figure 15 shown, the method for writing the process transaction log in the database further includes:

[0113] Step S700, if it is determined that the process is not a follower process, the process acts as the leader process of the process group. The leader process is denoted as the leader process, or can also be denoted as leader.

[0114] Step S710, the leader process acquires a transaction log insertion lock.

[0115] Step S720, the leader process copies the transaction log data of the leader process to the pre-allocated write-ahead log buffer, and the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list nodes.

[0116] Step S730, the leader process releases the transaction log insertion lock.

[0117] In this embodiment, the leader process has the permission to copy the transaction log data of the leader process to the pre-allocated write-ahead log buffer, and to copy the transaction log data of the follower process corresponding to the leader process to the pre-allocated write-ahead log buffer.

[0118] After each transaction log is generated, the process that generates the transaction log may become the leader process or the follower process, and can only be one of the leader process and the follower process types. However, only the leader process can obtain the transaction log insert lock. After the leader process obtains the transaction log insert lock, it will copy its own transaction log data to the pre-allocated write-ahead log buffer. Of course, the leader process can also copy the transaction log data of the follower process corresponding to the leader process to the pre-allocated write-ahead log buffer. The follower process cannot independently copy the transaction log data it generates to the pre-allocated write-ahead log buffer, nor can it copy the transaction log data of other follower processes to the pre-allocated write-ahead log buffer. It can only wait for the corresponding leader process to copy its transaction log data to the pre-allocated write-ahead log buffer.

[0119] Specifically, after obtaining that a process is the leader process, the leader process obtains the transaction log insert lock. After the leader process obtains the transaction log insert lock, it copies its own transaction log data to the pre-allocated write-ahead log buffer. And, the leader process continues to hold the log insert lock and copies the transaction log data of the corresponding follower process to the pre-allocated write-ahead log buffer. After the leader process copies its own transaction log and the transaction log data of all corresponding follower processes to the pre-allocated write-ahead log buffer, that is, when there is no transaction log data of any process that needs to be copied by the leader process to the pre-allocated write-ahead log buffer, that is, after the leader process completes writing the transaction log data of all corresponding processes to the pre-allocated write-ahead log buffer, the leader process releases the transaction log insert lock.

[0120] In this embodiment, the leader process obtains the transaction log insert lock, and after the leader process obtains the transaction log insert lock, it can not only copy its own transaction log data to the pre-allocated write-ahead log buffer, but also copy the transaction log data generated by the corresponding follower process to the pre-allocated write-ahead log buffer. Compared with the prior art where each process needs to obtain the transaction log insert lock once for copying the transaction log data, the method of the leader process copying the transaction log data of all processes to the pre-allocated write-ahead log buffer significantly reduces the number of times of obtaining and releasing the insert lock during the transaction log data copying process, and improves the efficiency of copying the transaction log data to the pre-allocated write-ahead log buffer.

[0121] In this embodiment, by merging the XLOG log copy process of the follower process, when there are more follower processes, the total number of XLOG log copies of the follower processes executed in the leader process can be reduced, thereby reducing the average time for the leader process to obtain the transaction log insert lock each time. And, the merging work of the XLOG log copy process of the follower process is mainly completed in the follower process, so no new performance loss will be introduced to the leader process.

[0122] In some embodiments of the present invention, the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node, including:

[0123] The leader process obtains the pre-allocated storage space range recorded in the linked list node from the linked list node. The starting position of the pre-allocated storage space range is begin_lSn, and the ending position is end_lSn.

[0124] Based on the pre-allocated storage space range recorded in the linked list node, the leader process copies the transaction log data of one or more processes stored in the linked list node (located in data, and data may contain the transaction logs of one or more processes) to the pre-allocated write-ahead log buffer.

[0125] In this embodiment, the leader process does not copy the transaction log data generated by the corresponding follower process one by one to the pre-allocated write-ahead log buffer, but copies each linked list node one by one to the pre-allocated write-ahead log buffer, so that the transaction log data of the corresponding one or more processes can be copied to the pre-allocated write-ahead log buffer at the same time. This makes the number of times of copying the transaction log data less than the number of processes, that is, less than the number of times of copying the transaction log data generated by the follower process one by one to the pre-allocated write-ahead log buffer. Obviously, the time for the leader process to hold the transaction log insertion lock is reduced. This method reduces the number of times of obtaining the insertion lock during the copying process of the transaction log data, improves the writing efficiency at the same time, can reduce the time for the leader process to hold the transaction log insertion lock, and improves the efficiency of copying the transaction log to the pre-allocated write-ahead log buffer.

[0126] Further, as Figure 5 shown, when there are 9 follower processes 12 as shown in the figure, there are only two linked list nodes in the group linked list. Thus, the behavior that originally needed to be copied 9 times is reduced to 2 times, which can reduce some overheads, and further reduce the average time for the leader process 11 to obtain the transaction log insertion lock each time.

[0127] In some embodiments of the present invention, as Figure 16 shown, each process group is configured with a linked list lock for forming the linked list of the process group. The method for writing the process transaction log in the database further includes:

[0128] Step S180, before judging whether the process is a follower process of the process group in the above step S200, enable the process to obtain the linked list lock of the corresponding process group, so that the process joins the corresponding group linked list based on the obtained linked list lock.

[0129] Step S800: After the process that obtains the linked list lock joins the corresponding group linked list, release the linked list lock of the corresponding process group.

[0130] To improve the efficiency of copying transaction log data to the pre-allocated write-ahead log buffer, the database has at least one process group. The number of process groups in the database can be pre-set or created after the database starts. Regardless of the method, the number of process groups is fixed, for example: 2, 4, 5, 7, etc. Preferably, the number of process groups can be set to 8. Each process in each process group will be assigned to a process group. When the database starts, a linked list head (head) and a corresponding linked list lock are created for each process group. The linked list lock is the key for the process corresponding to the process group to enter or remove from the process group. That is to say, for the process assigned to the process group, whether it enters or removes from the corresponding process group, it has to obtain the corresponding linked list lock. A process that has not obtained the corresponding linked list lock cannot enter the corresponding process group.

[0131] The processes are assigned to the corresponding process groups according to a preset rule, and the processes that have assembled the transaction log data sequentially obtain the linked list locks of the corresponding process groups. After obtaining the linked list lock of the process group, the process holding the linked list lock joins the group linked list of the corresponding process group. Then the process releases the linked list lock so that other processes belonging to the same process group can quickly obtain the linked list lock and join the process group.

[0132] In this embodiment, each process group has a linked list head and a corresponding linked list lock. A process can only join the group linked list of the corresponding process group after obtaining the linked list lock of the corresponding process group. Each process group has only one linked list lock, and only one process can obtain the linked list lock at a time, so that the processes assigned to the process group join the group linked list of the corresponding process group in order, avoiding congestion. The linked list head is used to mark the starting position of the group linked list.

[0133] Normally, after the leader process joins the group linked list, it releases the linked list lock so that other new processes in the same group can quickly obtain the linked list lock and then join the group linked list. It can also be said that during the process of the leader process copying the transaction log data of the leader process to the pre-allocated write-ahead log buffer, other new processes in the same group can quickly obtain the linked list lock. At this time, the process that obtains the linked list lock and joins the group linked list is the follower process corresponding to the leader process, making the operations synchronized and improving the operation efficiency. That is, the linked list nodes corresponding to the follower processes are mainly added during the period when the leader process copies the transaction log data of the leader process to the pre-allocated write-ahead log buffer.

[0134] As Figure 17 shown, in some embodiments of the present invention, the above step S200 of determining whether a process is a follower process of a process group includes:

[0135] Step S310, after each process acquires the corresponding linked list lock, check whether the corresponding group linked list is empty;

[0136] If it is, execute Step S311; if not, execute Step S312.

[0137] Step S311, the process serves as the leader process of the process group;

[0138] Step S312, the process serves as a follower process of the process group.

[0139] That is, determining whether a process serves as a follower process of a process group can be between Step S180 and Step S800.

[0140] To determine the type of each process, after the process acquires the corresponding linked list lock, check the group linked list of the corresponding process group to determine whether the group linked list is empty. Determine the type of the process entering the process group this time according to the check result of the group linked list. Specifically, when the group linked list is empty, it means that there is no process in the process group at this time, and the process that holds the linked list lock and is about to enter the process group is the first process of the process group, and this process will become the leader process of the corresponding process group after entering the process group. Of course, when a process acquires the linked list lock and checks the group linked list, the group linked list may also be non-empty. The non-empty group linked list indicates that there are already other processes in the corresponding process group, and the process that holds the linked list lock and is about to enter the process group will become a follower process of the corresponding process group after entering the process group. Further, the form of each group linked list is as Figure 3 shown. The linked list node corresponding to the leader process stores the process number of the leader process. If process x records its process number as pid_x, then the pid at the linked list node corresponding to the leader process is recorded as pid_x. Each of the other linked list nodes of the group linked list records the information of one or more follower processes. Here, process x is the leader process of the group_num process group.

[0141] In this embodiment, by judging whether the group linked list is empty to determine the type of the process, the determination methods of the leader process and the follower process are clarified, which is beneficial to the operation when the subsequent transaction log data is copied to the pre-allocated write-ahead log buffer.

[0142] In some embodiments of the present invention. The process allocates process groups, including:

[0143] Mark the process numbers of the processes;

[0144] According to the process number markings and the number of process groups, divide the processes into the corresponding process groups.

[0145] The number of process groups has been preset in the database. Each process is marked with a process number in the database so that each process has its own process identifier. After the process number marking is completed, the processes are grouped according to the process number marking and the preset number of process groups, so that each process is assigned to the corresponding process group. In this embodiment, the rules for process grouping are clarified so that each process can be assigned to the corresponding process group according to the established rules, avoiding grouping chaos.

[0146] In some embodiments of the present invention, the number of preset process groups is used to perform a modulo operation on the process number marking and the number of process groups. Processes with the same remainder belong to the same process group number (group_num), and processes with the same process group number are assigned to the same process group. The number of preset process groups can be 8, that is, all processes will be divided into 8 groups. At this time, for the processes with process number markings of 5, 13, 21, and 29, since the remainder after dividing the process number marking by 8 is 5, they will be assigned to the same process group. Of course, the remaining processes with a remainder of 5 after dividing by 8 will also be assigned to this process group. In this embodiment, the modulo operation is used for process grouping, and the calculation method is simple.

[0147] As Figure 18 shown, in some embodiments of the present invention, the leader process copies the transaction log data of the leader process to the pre-allocated write-ahead log buffer, and the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node, including:

[0148] Step S810, the leader process copies the transaction log data of the leader process to the pre-allocated write-ahead log buffer;

[0149] Step S820, the leader process obtains the linked list lock of the process group, removes the leader process from the group linked list of the corresponding process group, and determines whether the group linked list of the process group is empty;

[0150] If not, execute step S890; Step S890, the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node;

[0151] If so, execute step S730; Step S730, the leader process releases the transaction log insertion lock.

[0152] After the leader process in the process group obtains the insert lock, it needs to complete the replication of the transaction log data of all processes in the corresponding process group. That is, the leader process needs to copy the transaction log data of all processes in the corresponding process group to the pre-allocated write-ahead log buffer. In specific operations, the leader process first copies its own transaction log data to the pre-allocated write-ahead log buffer. After the leader process finishes copying and writing its own transaction log data, it removes the corresponding group linked list from the group linked list of the process group and checks whether the corresponding group linked list is empty. When the group linked list is not empty, it means that there is still transaction log data of follower processes in the corresponding process group waiting to be replicated. At this time, the leader process needs to copy the transaction log data of the corresponding follower processes to the pre-allocated write-ahead log buffer based on the linked list nodes. Of course, when the group linked list is empty, it means that there is no transaction log data of follower processes in the corresponding process group waiting to be replicated, indicating that the leader process has copied all the transaction log data of the corresponding process group to the pre-allocated write-ahead log buffer. At this time, the leader process releases the transaction log insert lock of this process group.

[0153] In this embodiment, after the leader process copies its own transaction log data to the pre-allocated write-ahead log buffer, it checks the group linked list of the corresponding process group to determine whether there is still transaction log data of unreplicated follower processes in the corresponding process group, and performs subsequent operations according to the check result.

[0154] In some embodiments of the present invention, such as Figure 18 and Figure 19 shown, before the leader process copies the transaction log data of the follower processes to the pre-allocated write-ahead log buffer based on the linked list node 20, the method for writing the process transaction log in the database further includes:

[0155] Step S830, the leader process changes the linked list head of the group linked list to obtain a write-linked list and releases the linked list head, and the released linked list head is used to form a new group linked list.

[0156] Step S840, the leader process releases the linked list lock of the process group so that new processes can join the new group linked list based on the linked list lock.

[0157] Further, in step S890, the leader process copies the transaction log data of the follower processes to the pre-allocated write-ahead log buffer based on the linked list nodes, including: the leader process copies the transaction log data of the follower processes to the pre-allocated write-ahead log buffer based on the linked list nodes of the write-linked list.

[0158] In this embodiment, during the process in which the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list nodes, the linked list head and the linked list lock can be released, which can be used to form a new group linked list. The two operations are carried out simultaneously without interfering with each other, improving the writing efficiency.

[0159] That is to say, as Figure 19 shown, after it is determined that the group linked list of the process group is not empty, the leader process changes the linked list head of the group linked list to obtain a new linked list head, that is, new_head, and records the group linked list (i.e., the linked list for writing) where the new linked list head is located as new_group_list, and the leader process releases the linked list lock of the process group. Then, the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node 20 of the linked list for writing.

[0160] In this embodiment, by forming a new linked list, all corresponding follower processes are removed from the group linked list of the corresponding process group, that is, a new linked list dedicated to writing is formed, that is, the linked list for writing. At this time, the leader process and all follower processes in the corresponding process group are removed, and the group linked list of the corresponding process group is empty. After that, the leader process releases the linked list lock of the corresponding process group. After the linked list lock is released, if a process allocated to this process group generates new transaction log data, the process that generates the new transaction log data will obtain the linked list lock and enter the corresponding process group. Because the linked list of the process group is empty before the process that generates the new transaction log data enters the process group, the process that generates the new transaction log data will become the new leader process of this process group. In this embodiment, the cancellation of the old leader process and the generation of the new leader process are extremely short in interval, and there is no performance bottleneck.

[0161] In some embodiments of the present invention, when the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list nodes, it further includes:

[0162] The leader process wakes up all follower processes in the linked list nodes. That is to say, when the leader process operates based on the corresponding linked list nodes, the leader process wakes up all follower processes corresponding to the linked list nodes (recorded in the proc_array array).

[0163] According to whether the transaction log data is being copied, the follower process has two states: a running state and a blocked state. The blocked follower process refers to the follower process that queues up waiting for the transaction log data to be copied by the leader process to the pre-allocated write-ahead log buffer; the running follower process refers to the follower process whose transaction log data has been copied by the leader process to the pre-allocated write-ahead log buffer.

[0164] Specifically, after the leader process copies the transaction log data of the follower process that has completed the pre-allocation of storage space to the pre-allocated storage space of the write-ahead log buffer based on the linked list node, it wakes up one or more blocked follower processes corresponding to the current linked list node based on the linked list node to make them in a running state. Then, based on the next linked list node, it wakes up one or more blocked follower processes corresponding to the next linked list node to make them in a running state.

[0165] In some embodiments of the present invention, the pre-allocation of storage space and the copying of transaction log data are sequentially performed on the follower processes on each linked list node. After the copying of the transaction log data of the follower process corresponding to one linked list node is completed, the copying of the transaction log data of the follower process corresponding to the next linked list node is performed. The copying of the transaction log data of the entire process group is carried out in an orderly manner, avoiding congestion and omission.

[0166] In some embodiments of the present invention, the method for writing the process transaction log in the database further includes:

[0167] The follower process repeatedly checks whether it has received a wake-up signal sent by the corresponding leader process;

[0168] If so, the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node;

[0169] If not, it continues to wait and repeatedly checks whether it has received a wake-up signal sent by the leader process.

[0170] In this embodiment, the blocked follower process should pay attention to whether the corresponding leader process sends it a wake-up signal. That is to say, the blocked follower process needs to repeatedly check whether it has received a wake-up signal sent by the corresponding leader process and take corresponding actions according to whether it has received the wake-up signal. When the blocked follower process receives a wake-up signal sent by the leader process, it will change from the blocked state to the running state, and the transaction log data waits to be written to the disk. When the blocked follower process does not receive a wake-up signal sent by the leader process, it will continue to wait and keep repeatedly checking until it receives the wake-up signal from the corresponding leader process. In this embodiment, the blocked follower process repeatedly checks whether the corresponding leader process sends it a wake-up signal and adjusts its own state according to whether it has received the wake-up signal.

[0171] Such as Figure 15As shown, in some embodiments of the present invention, in the method for writing process transaction logs in a database, when the leader process releases the transaction log insertion lock, it indicates that the replication of the transaction logs of each process in the corresponding process group is completed. Then, step S900 is entered, and the transaction log data cached in the write-ahead log buffer waits to be written to the disk.

[0172] The present invention also provides a machine-readable storage medium and a computer device. Figure 20 It is a schematic diagram of a machine-readable storage medium 40 according to an embodiment of the present invention. Figure 21 It is a schematic diagram of a computer device 50 according to an embodiment of the present invention.

[0173] The machine-readable storage medium 40 stores thereon a machine-executable program 41, and when the machine-executable program 41 is executed by a processor, it implements the method for writing process transaction logs in the database in any of the above embodiments.

[0174] The computer device 50 may include a memory 520, a processor 510, and a machine-executable program 41 stored on the memory 520 and running on the processor 510, and when the processor 510 executes the machine-executable program 41, it implements the method for writing process transaction logs in the database in any of the above embodiments.

[0175] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a definite sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any machine-readable storage medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or in combination with these instruction execution systems, apparatus, or devices.

[0176] For the description of this embodiment, the machine-readable storage medium 40 can be any device that can contain, store, communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. More specific examples (non-exhaustive list) of the machine-readable storage medium 40 include the following: an electrical connection portion (electronic device) having one or more wirings, a portable computer diskette (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the machine-readable storage medium 40 can even be paper or other suitable media on which a program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation, or otherwise processing it in a suitable manner if necessary, and then storing it in a computer memory.

[0177] It should be understood that various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above-described embodiment, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.

[0178] The computer device 50 can be, for example, a server, a desktop computer, a laptop computer, a tablet computer, or a smartphone. In some examples, the computer device 50 can be a cloud computing node. The computer device 50 can be described in the general context of computer system-executable instructions, such as program modules, executed by a computer system. Generally, program modules can include routines, programs, object programs, components, logic, data structures, etc. that perform specific tasks or implement specific abstract data types. The computer device 50 can be implemented in a distributed cloud computing environment where tasks are executed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.

[0179] The computer device 50 can include a processor 510 adapted to execute stored instructions and a memory 520 that provides temporary storage space for the operation of the instructions during operation. The processor 510 can be a single-core processor, a multi-core processor, a computing cluster, or any other number of other configurations. The memory 520 can include a random access memory (RAM), a read-only memory, a flash memory, or any other suitable storage system.

[0180] The processor 510 can be connected via a system interconnect (such as PCI, PCI-Express, etc.) to an I / O interface (input / output interface) suitable for connecting the computer device 50 to one or more I / O devices (input / output devices). The I / O devices can include, for example, a keyboard and a pointing device, where the pointing device can include a touchpad or a touch screen, etc. The I / O devices can be built-in components of the computer device 50, or can be devices externally connected to the computing device.

[0181] The processor 510 can also be linked via a system interconnect to a display interface suitable for connecting the computer device 50 to a display device. The display device can include a display screen as a built-in component of the computer device 50. The display device can also include a computer monitor, a television, a projector, etc. externally connected to the computer device 50. In addition, a network interface controller (NIC) can be suitable for connecting the computer device 50 to a network via a system interconnect. In some embodiments, the NIC can use any suitable interface or protocol (such as Internet Small Computer System Interface, etc.) to transmit data. The network can be a cellular network, a radio network, a wide area network (WAN), a local area network (LAN), or the Internet, etc. A remote device can be connected to the computing device via the network.

[0182] The flowchart provided in this embodiment is not intended to indicate that the operations of the method will be executed in any specific order, or that all operations of the method are included in every case. In addition, the method can include additional operations. Within the scope of the technical concept provided by the method in this embodiment, additional changes can be made to the above method. At this point, those skilled in the art should recognize that although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived from the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all these other variations or modifications.

[0183] In the description of this embodiment, the descriptions referring to terms such as "one embodiment", "some embodiments", "schematic embodiments", "examples", "specific examples", or "some examples", etc. mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.

[0184] At this point, those skilled in the art should recognize that although numerous exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all such other variations or modifications.

Claims

1. A method for writing process transaction logs in a database, characterized in that, The database is configured with at least one process group or creates at least one process group, and the process group is configured to accommodate processes that generate transaction log data. The method for writing process transaction logs in the database includes: Allocating the process group to the process so that the process can be added to the group linked list of the process group; Determining whether the process is a follower process of the process group; If so, determining whether there is a target linked list node on the group linked list; wherein the pre-allocated storage space range recorded by the target linked list node is adjacent to the pre-allocated storage space range of the follower process; If there is one target linked list node, merging the follower process into the target linked list node; If there are two target linked list nodes, merging one target linked list node and the follower process into the other target linked list node; or merging the follower process into one of the target linked list nodes; If there is no target linked list node, creating a linked list node for the follower process on the group linked list.

2. The method for writing a process transaction log in the database according to claim 1, wherein It further includes: If it is determined that the process is not a follower process, the process is a leader process of the process group; The leader process acquires a transaction log insertion lock; The leader process copies the transaction log data of the leader process to a pre-allocated write-ahead log buffer, and based on the linked list node, the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer; The leader process releases the transaction log insertion lock.

3. The method for writing process transaction logs in the database according to claim 1, wherein Before determining whether there is a target linked list node on the group linked list of the process group, it further includes: Checking whether there is a linked list node corresponding to the follower process that has already been added to the group linked list on the group linked list of the process group; If not, creating a linked list node for the follower process on the group linked list; If so, entering the determination of whether there is a target linked list node on the group linked list of the process group.

4. The method for writing process transaction logs in the database according to claim 2, wherein The leader process copying the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node includes: The leader process obtains the pre-allocated storage space range recorded by the linked list node from the linked list node; Based on the pre-allocated storage space range recorded by the linked list node, the leader process copies the transaction log data of one or more of the processes stored in the linked list node to the pre-allocated write-ahead log buffer.

5. The method for writing process transaction logs in the database according to claim 1, wherein The linked list node stores the process numbers, transaction log data, and start position information and end position information of the pre-allocated storage space range corresponding to one or more of the processes.

6. The method for writing a process transaction log in the database according to claim 2, wherein Before the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node, it further includes: The leader process changes the linked list head of the group linked list to obtain a write-used linked list and releases the linked list head, and the released linked list head is used to form a new group linked list; The leader process releases the linked list lock of the process group, so that the new process joins the new group linked list based on the linked list lock; where The leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node, including: The leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list nodes of the write-used linked list.

7. The method for writing process transaction logs in the database according to claim 2, characterized in that The leader process copies the transaction log data of the leader process to the pre-allocated write-ahead log buffer, and the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node, including: The leader process copies the transaction log data of the leader process to the pre-allocated write-ahead log buffer; The leader process obtains the linked list lock of the process group, removes the leader process from the group linked list of the process group, and determines whether the group linked list of the process group is empty; If not, the leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node.

8. The method for writing process transaction logs in the database according to claim 4, characterized in that The leader process copies the transaction log data of the follower process to the pre-allocated write-ahead log buffer based on the linked list node, and further includes: the leader process wakes up all the follower processes in the linked list node; The method for writing process transaction logs in the database further includes: The follower process repeatedly checks whether it receives a wake-up signal sent by the leader process; If so, the follower process is in a running state; If not, the follower process continues to wait and repeatedly checks whether it receives a wake-up signal sent by the leader process.

9. The method for writing process transaction logs in the database according to claim 1, characterized in that Each process group is configured with a linked list lock and a linked list head for forming a group linked list of the process group; The method for writing process transaction logs in the database further includes: Before determining whether the process is a follower process of the process group, the process obtains the linked list lock corresponding to the process group, so that the process joins the corresponding group linked list based on the obtained linked list lock; After the process that obtains the linked list lock joins the corresponding group linked list, it releases the linked list lock corresponding to the process group.

10. The method for writing a process transaction log in the database according to claim 9, wherein The determination of whether the process is a follower process of the process group includes: After each of the processes acquires the corresponding linked list lock, check whether the corresponding group linked list is empty; If so, the process is the leader process of the process group; if not, the process is the follower process of the process group.

11. A machine-readable storage medium having a machine-executable program stored thereon, characterized in that, When the machine-executable program is executed by a processor, it implements the method for writing process transaction logs in the database according to any one of claims 1 to 10.

12. A computer device, characterized in that, It includes a memory, a processor, and a machine-executable program stored on the memory and running on the processor, and when the processor executes the machine-executable program, it implements the method for writing process transaction logs in the database according to any one of claims 1 to 10.