Database log processing method

By separating page mirror data and other data in the database log and using preset locks to manage the log serial number range, the problem of large amount of data during the database synchronization process is solved, synchronization efficiency and security are improved, and working pressure during the drop-off stage is reduced.

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

Patent Information

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

AI Technical Summary

Technical Problem

During the database synchronization process, the large amount of data in the database logs leads to the impact of the synchronous stream replication performance, and the prior art is difficult to effectively reduce the amount of data synchronization between the main and standby databases.

Method used

The page mirror data in the database log is processed separately from other data. By assembling the structure of the linked list and the page data link list, the page data link list is stored in the global page data link list, and the log serial number range is bound using a preset lock to ensure that the data is arranged in ascending order of the serial number and reduce the amount of synchronized data.

Benefits of technology

It improves the efficiency of database synchronization, reduces the amount of data synchronization between the main and backup databases, ensures the security and stability of the database, and reduces the working pressure during the disk drop stage and improves storage efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120277151A_ABST
    Figure CN120277151A_ABST
Patent Text Reader

Abstract

The invention provides a database log processing method. The database log processing method comprises the steps of obtaining a database log; reading and recording a log serial number of the database log, and recording the log serial number as a reference serial number; obtaining a page data chain table of the database log, and recording the page data chain table as a to-be-stored page data chain table; available preset locks of a preset global page data linked list are obtained, the global page data linked list is pre-configured with a preset number of preset locks, and each preset lock is bound with a log serial number range; and storing the to-be-stored page data chain table into the global page data chain table according to the ascending order of the log serial numbers according to the reference serial number. According to the method, the page data chain table is independently stored in the global page data chain table, the page mirror image data and other data except the page mirror image data in the database log can be stored in the disk subsequently, only the other data except the page mirror image data can be synchronized during synchronization, and therefore the data synchronization amount between the main database and the standby database is reduced.
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 particularly to a method for processing database logs. Background Art

[0002] During the use of a database, database logs will be recorded. An important function of database logs is to be used for constructing a primary and standby database cluster. Briefly speaking, after the primary and standby database cluster is constructed, the primary database provides read and write services externally and continuously generates database logs. The database logs are transmitted to the standby database through streaming replication, so that the standby database is nearly consistent with the primary database.

[0003] In order to make the data of the primary database and the standby database strictly consistent, a synchronous streaming replication mode is usually adopted. In the synchronous streaming replication mode, after the primary database sends a database log to the standby database, it needs to wait for the standby database to store this database log locally or replay it successfully before the primary database can continue to execute. Therefore, the amount of data of the database logs that the primary database needs to transmit to the standby database is an important factor affecting the performance of synchronous streaming replication. Summary of the Invention

[0004] An object of the present invention is to provide a method for processing database logs that can reduce the amount of data of the database logs to be transmitted.

[0005] Specifically, the present invention provides a method for processing database logs, including:

[0006] Obtain database logs, where the database logs are pre-assembled into a structure composed of an assembly linked list and a page data linked list connected after the assembly linked list. The page data linked list is a linked list composed of page mirror data in the database logs, and the assembly linked list is a linked list composed of other data except the page mirror data in the database logs;

[0007] Read and record the log sequence number of the database logs, denoted as the reference sequence number;

[0008] Obtain the page data linked list of the database logs, denoted as the page data linked list to be stored;

[0009] Obtain an available preset lock of the preset global page data linked list. The global page data linked list is used to store the page data linked list. The global page data linked list is pre-configured with a preset number of preset locks, and each preset lock can bind a range of log sequence numbers. The available preset lock is a preset lock whose bound range of log sequence numbers includes the reference sequence number;

[0010] Store the linked list of page data to be stored into the global page data linked list in ascending order of log sequence numbers according to the reference sequence number, so that the page data linked lists in the global page data linked list are connected in sequence in ascending order of log sequence numbers.

[0011] Optionally, before the step of obtaining the available preset locks of the preset global page data linked list:

[0012] Detect whether there is an available preset lock among the preset locks already used in the global page data linked list. If so, execute the step of obtaining the available preset locks of the preset global page data linked list;

[0013] If not, determine the required range of new log sequence numbers according to the first preset rule, and the reference sequence number is within the range of new log sequence numbers;

[0014] Obtain a preset lock from the unused preset locks of the global page data linked list, and denote it as the preset lock to be assigned;

[0015] Bind the range of new log sequence numbers to the preset lock to be assigned to make it an available preset lock;

[0016] Among them, the used preset lock refers to the preset lock to which the log sequence number range has been bound, and the unused preset lock refers to the preset lock to which the log sequence number range has not been bound yet.

[0017] Optionally, the step of determining the required range of new log sequence numbers according to the first preset rule includes:

[0018] Obtain the maximum value among the log sequence number ranges bound by all the used preset locks of the global page data linked list, and denote it as the first sequence number;

[0019] Determine that the range of new log sequence numbers is greater than the first sequence number and less than or equal to the reference sequence number.

[0020] Optionally, before the step of determining that the range of new log sequence numbers is greater than the first sequence number and less than or equal to the reference sequence number:

[0021] Judge whether the difference between the reference sequence number and the first sequence number is greater than the preset threshold. If so, execute the step of determining that the range of new log sequence numbers is greater than the first sequence number and less than or equal to the reference sequence number. If not, determine that the range of new log sequence numbers is greater than the first sequence number and less than or equal to the first sequence number plus the preset threshold.

[0022] Optionally, before the step of obtaining a preset lock from the unused preset locks of the global page data linked list:

[0023] Judge whether the global page data linked list still has unused preset locks;

[0024] If so, perform the step of obtaining a pre-set lock from the unused pre-set locks in the global page data linked list;

[0025] If not, find two pre-set locks with the smallest maximum value of the bound log sequence number range from the used pre-set locks, denoted as the first pre-set lock to be modified and the second pre-set lock to be modified, where the maximum value of the log sequence number range of the first pre-set lock to be modified is less than the maximum value of the log sequence number range of the second pre-set lock to be modified;

[0026] Modify the maximum value of the log sequence number range of the first pre-set lock to be modified to the maximum value of the log sequence number range of the second pre-set lock to be modified;

[0027] Bind a new log sequence number range to the second pre-set lock to be modified to make it an available pre-set lock.

[0028] Optionally, before the step of detecting whether there is an available pre-set lock among the used pre-set locks in the global page data linked list, it includes:

[0029] Detect whether there are used pre-set locks in the global page data linked list. If so, perform the step of detecting whether there is an available pre-set lock among the used pre-set locks in the global page data linked list;

[0030] If not, determine the required new added log sequence number range according to the second preset rule, and the reference sequence number is within the new added log sequence number range;

[0031] Obtain a pre-set lock;

[0032] Bind a new added log sequence number range to the pre-set lock to make it an available pre-set lock.

[0033] Optionally, the step of determining the required new added log sequence number range according to the second preset rule includes:

[0034] Obtain the log sequence number corresponding to the last disk-written database log currently, denoted as the second sequence number;

[0035] Determine that the new added log sequence number range is greater than the second sequence number and less than or equal to the reference sequence number.

[0036] Optionally, before the step of determining that the new added log sequence number range is greater than the second sequence number and less than or equal to the reference sequence number, it includes:

[0037] Judge whether the difference between the reference sequence number and the second sequence number is greater than the preset threshold. If so, perform the step of determining that the new added log sequence number range is greater than the second sequence number and less than or equal to the reference sequence number. If not, determine that the new added log sequence number range is greater than the second sequence number and less than or equal to the second sequence number plus the preset threshold.

[0038] Optionally, the step of storing the linked list of page data to be stored into the global page data linked list in ascending order of log sequence numbers according to the reference sequence number includes:

[0039] Check whether there is a basic page data linked list in the global page data linked list. The basic page data linked list is a linked list of page data within the range of log sequence numbers of available preset locks.

[0040] If so, connect the linked list of page data to be stored and the basic page data linked list in ascending order of log sequence numbers according to the reference sequence number.

[0041] If not, obtain all the preset locks of the global page data linked list.

[0042] Find the first page data linked list in the global page data linked list from the back forward whose log sequence number is less than the reference sequence number, and connect the linked list of page data to be stored to the back of the first page data linked list whose log sequence number is less than the reference sequence number.

[0043] Optionally, before the step of finding the first page data linked list in the global page data linked list from the back forward whose log sequence number is less than the reference sequence number includes:

[0044] Check whether the global page data linked list is empty. If so, store the linked list of page data to be stored into the global page data linked list. If not, execute the step of finding the first page data linked list in the global page data linked list from the back forward whose log sequence number is less than the reference sequence number.

[0045] The method for processing database logs of the present invention obtains database logs including an assembled linked list and a page data linked list, reads and records the log sequence number of the database logs, denoted as the reference sequence number, obtains the page data linked list of the database logs, denoted as the linked list of page data to be stored, obtains the available preset locks of the preset global page data linked list, and stores the linked list of page data to be stored into the global page data linked list in ascending order of log sequence numbers according to the reference sequence number. That is to say, the page data linked list in the database logs is separated from the database logs and stored separately in the global page data linked list. That is to say, the page mirror data of the database logs and other data except the page mirror data can be written into the cache separately. Then, in the subsequent process of flushing to disk, the page mirror data in the database logs and other data except the page mirror data can be flushed to disk separately. Therefore, when this database synchronizes database logs to other standby databases, it can synchronize only other data except the page mirror data, thereby reducing the data synchronization volume between the primary and standby databases and helping to improve the synchronization efficiency. Moreover, the page mirror data of the database logs is still stored on the disk, which can also ensure the security and stability of this database.

[0046] Moreover, by storing the linked list of page data to be stored into the global page data linked list in ascending order of log sequence numbers according to the reference sequence numbers, the page data linked lists in the global page data linked list are connected in turn in ascending order of log sequence numbers. In the subsequent disk writing stage, there is no need to perform additional sorting work on the global page data linked list, reducing the workload in the disk writing stage and improving the disk writing efficiency.

[0047] In addition, by pre-configuring a preset number of preset locks for the global page data linked list, each preset lock is bound to a range of log sequence numbers, so that different page data linked lists within the ranges of log sequence numbers of different preset locks can obtain the preset locks within their respective ranges, and thus execute the task of storing into the global page data linked list without interference from each other. On the basis of ensuring that the page data linked lists in the global page data linked list are connected in order, the concurrency of storing the page data linked list into the global page data linked list is improved, which further helps to improve the storage efficiency of the page data linked list into the global page data linked list.

[0048] Through 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. Description of the Drawings

[0049] Some specific embodiments of the present invention will be described in detail hereinafter with reference to the accompanying drawings in an exemplary but not restrictive 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:

[0050] Figure 1 is a schematic diagram of a database log in the prior art;

[0051] Figure 2 is a schematic flowchart of a method for processing a database log according to an embodiment of the present invention;

[0052] Figure 3 is a first schematic diagram of a database log according to an embodiment of the present invention;

[0053] Figure 4 is a second schematic diagram of a database log according to an embodiment of the present invention;

[0054] Figure 5 is a schematic diagram of a page data linked list of a database log according to an embodiment of the present invention;

[0055] Figure 6 is a schematic diagram of the content of page mirror data of a database log according to an embodiment of the present invention;

[0056] Figure 7It is the third schematic diagram of the database log according to an embodiment of the present invention;

[0057] Figure 8 It is the schematic diagram of the global page data linked list according to an embodiment of the present invention;

[0058] Figure 9 It is the schematic flowchart of the step of storing the page data linked list to be stored into the global page data linked list in the database log processing method according to an embodiment of the present invention;

[0059] Figure 10 It is the schematic flowchart of the database log processing method according to another embodiment of the present invention;

[0060] Figure 11 It is the schematic flowchart of the step of determining the required range of new log sequence numbers according to the first preset rule in the database log processing method according to another embodiment of the present invention;

[0061] Figure 12 It is the schematic flowchart of the database log processing method according to still another embodiment of the present invention;

[0062] Figure 13 It is the schematic flowchart of the database log processing method according to still another embodiment of the present invention;

[0063] Figure 14 It is the schematic flowchart of the step of determining the required range of new added log sequence numbers according to the second preset rule in the database log processing method according to still another embodiment of the present invention;

[0064] Figure 15 It is the schematic flowchart of the database log processing method according to still another embodiment of the present invention;

[0065] Figure 16 It is the schematic flowchart of the database log processing method according to still another embodiment of the present invention;

[0066] Figure 17 It is the schematic diagram of the page mirror data storage table according to an embodiment of the present invention. Detailed implementation manners

[0067] Those skilled in the art should understand that the embodiments described below are only a part of the embodiments of the present invention, rather than all of the embodiments of the present invention. This part of the embodiments is intended to explain the technical principles of the present invention, rather than to limit the protection scope of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall still fall within the protection scope of the present invention.

[0068] 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 computer-readable 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 instructions from the instruction execution system, apparatus, or device and execute the instructions), or used in combination with these instruction execution systems, apparatus, or devices.

[0069] The flowchart provided by the present invention 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 may 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.

[0070] To facilitate the understanding of this solution, the operation mode of the database in the prior art will be described. First, during the process of modifying the database data, the table stored on the disk is not directly modified. Instead, the data in the table is extracted into the cache in units of data pages (the data to be modified is located in the data pages), modified in the cache, and then written to the disk later.

[0071] Furthermore, when modifying the data pages in the cache, database logs will be generated. As Figure 1 shown, the existing database logs generally include two parts: a header and a data area. The data area records various modification operations on the data pages. At the same time, there is also a kind of data in the data area that is page mirror data. The page mirror data is formed after recording the complete page information of a data page in the database log. In the prior art, usually after the log redo point (the log redo point is a log sequence number. Before this log sequence number, the database logs have all been written to the disk and the information reflected by the written logs and all the data in the actual database on the disk is the same), if the data of a data page in the cache is modified for the first time, then the entire page information of the data page after the first modification will be recorded in the database log, and then page mirror data will be generated.

[0072] Because during the process of writing a data page to the disk, it is possible that a data page crashes during the write process, resulting in a situation where the written data page contains a mixture of old and new data. Therefore, by generating page mirror data, the broken page with the mixture of old and new data can be replaced with the data page information recorded in the page mirror data, and then the subsequent operations recorded in the database log can be replayed to complete the recovery of the data page.

[0073] Therefore, page mirror data is important data for ensuring the security and stability of the database where it is located. However, during the synchronization process of the primary and standby databases, the page mirror data in the database log of the primary database will not affect the data consistency of the primary and standby databases even if it is not synchronized to the standby database. That is to say, if it is possible to separate the page mirror data from the database log of the primary database on the basis of ensuring that the page mirror data of the primary database can be recorded, the amount of data that the primary database needs to synchronize to the standby database can be reduced on the premise of ensuring the security and stability of the primary database.

[0074] As Figure 2 shown, in one embodiment, a method for processing a database log generally includes:

[0075] Step S101, obtain a database log. The database log is pre-assembled into a structure composed of an assembly linked list and a page data linked list connected after the assembly linked list. The page data linked list is a linked list composed of page mirror data in the database log, and the assembly linked list is a linked list composed of other data in the database log except for page mirror data. Specifically, during the assembly process of the database log, the page mirror data of the database log is connected in the form of a page data linked list after the assembly linked list composed of other data of the database log.

[0076] Referring to Figures 3 to 7 shown, specifically, taking a database log with two page mirror data nodes as an example, Figure 3 is an example of the linked list form of an original database log with page mirror data, Figure 4 is Figure 3 an example of the linked list form after removing the page mirror data from the linked list in, where next represents pointing to the next node; len represents the len function for calculating the length of the corresponding data; head data is the header data of the database log; page data is all the page mirror data in the database log; tupledata and main data are other data in the database log except for page mirror data. Figure 5 is a simplified example of the linked list of two page mirror data nodes in the database log. wal1 page data1 and wal1 pagedata2 are only simple notations for representing two different page mirror data nodes belonging to the same database log and do not represent specific contents. Figure 6An example of the specific content of a page mirror data node. RelFileNode represents the location information of the table to which the data page corresponding to this page mirror data belongs on the disk. BlockNumber represents the block number of the data page corresponding to this page mirror data in the table to which it belongs. Therefore, RelFileNode and BlockNumber can determine the location of the data page corresponding to the page mirror data on the disk. lsn represents the log sequence number of the database log to which the page mirror data belongs. page data is the complete information of the data page recorded by this page mirror data node. next points to the next node. Figure 7 An example of the finally formed database log.

[0077] During the assembly process of the database log, first remove the page mirror data in the database log, as Figures 3 to 4 shown. Then form a linked list of page data from the page mirror data in the order in the database log, as Figure 5 shown. Then, connect the linked list of page data to the rear of the linked list composed of other data in the database log, thereby assembling the database log into a structure composed of an assembly linked list and a linked list of page data connected after the assembly linked list, as Figure 7 shown. That is to say, Figure 6 can be regarded as Figure 5 a schematic diagram of the specific content of a page mirror data node in Figure 7 The assembly linked list in Figure 4 represents the linked list of the database log in

[0078] Step S102, read and record the log sequence number of the database log, denoted as the reference sequence number. The log sequence number is incrementally configured during the formation of the database log and can identify the order of the database log. After obtaining the database log, read and record the log sequence number of this database log, denoted as the reference sequence number.

[0079] Step S103, obtain the linked list of page data of the database log, denoted as the linked list of page data to be stored. Specifically, remove the linked list of page data in the database log from the database log. Refer to Figure 7 shown, that is, remove the part of the linked list after connecting the assembly linked list. The removed part is the linked list of page data to be stored. In simple terms, it is Figure 5 the linked list composed of the page mirror data of this database log shown.

[0080] Step S104: Obtain the available preset locks of the preset global page data linked list. The global page data linked list is used to store page data linked lists. The global page data linked list is pre-configured with a preset number of preset locks, and each preset lock can bind a range of log sequence numbers. The available preset locks are the preset locks whose bound log sequence number ranges contain the reference sequence number. The preset locks are mutex locks.

[0081] Specifically, the global page data linked list is located in the shared memory, that is, the cache. After moving out the page data linked list of the database log, it is necessary to store the page data linked list into the global page data linked list, that is, store the page data linked list to be stored into the global page data linked list. Refer to Figure 8 As shown, it is a simple schematic diagram of the global page data linked list storing two page data linked lists. page_data_list_local represents the page data linked list of a database log, and page_data_list_global represents the global page data linked list. Among them, wal1 and wal2 are only used to indicate that the two page data linked lists belong to different database logs.

[0082] Furthermore, the global page data linked list is pre-configured with a preset number of preset locks. For example, the preset number can be 8. Each preset lock can bind a range of log sequence numbers, which is a range that is open in the front and closed in the back, and the log sequence number ranges bound by each preset lock do not overlap. Specifically, each preset lock and its corresponding log sequence number range are encapsulated in a structure. Exemplarily, the log sequence number range of a preset lock is (5, 10], that is, the range where the log sequence number is greater than 5 and less than or equal to 10.

[0083] It should be noted that the above numbers are only simple schematics for the convenience of explanation and understanding, and do not represent the actual form of the log sequence numbers.

[0084] Therefore, before storing the page data linked list to be stored into the global page data linked list, obtain the available preset locks, so that within the log sequence number range of the available preset locks, only one page data linked list to be stored can perform the task of storing into the global page data linked list, avoiding chaos caused by multiple page data linked lists storing into the global page data linked list simultaneously.

[0085] It should be noted that those skilled in the art can flexibly set the value of the preset number according to needs.

[0086] Step S105: Store the page data linked list to be stored into the global page data linked list in ascending order of the log sequence number according to the reference sequence number, so that the page data linked lists in the global page data linked list are connected in ascending order of the log sequence number.

[0087] Specifically, after obtaining an available preset lock, the linked list of page data to be stored can be stored in the global page data linked list, and when storing, the linked list of page data to be stored is stored in the order of ascending log sequence numbers. In other words, all the page data linked lists in the global page data linked list are connected in sequence in the order of ascending log sequence numbers.

[0088] Combined with Figure 9 As shown, specifically, the steps of storing the linked list of page data to be stored in the global page data linked list in the order of ascending log sequence numbers according to the reference sequence number include:

[0089] Step S201, check whether there is a basic page data linked list in the global page data linked list. The basic page data linked list is the page data linked list within the log sequence number range of the available preset lock. If so, execute step S202; if not, execute step S203. Specifically, that is, for the log sequence number range bound by the available preset lock, whether there is a page data linked list with a log sequence number within this range that has been stored in the global page data linked list.

[0090] Step S202, connect the linked list of page data to be stored and the basic page data linked list in the order of ascending log sequence numbers according to the reference sequence number. Specifically, if there is a basic page data linked list in the global page data linked list, it means that there is a basic connection node for the linked list of page data to be stored within the log sequence number range of the available preset lock. Just connect the linked list of page data to be stored with the basic page data linked list in the order of ascending log sequence numbers.

[0091] Specifically, traverse all the basic page data linked lists from back to front. If the first page data linked list with a log sequence number smaller than the reference sequence number is found, connect the linked list of page data to be stored after the first page data linked list with a log sequence number smaller than the reference sequence number; if no page data linked list with a log sequence number smaller than the reference sequence number is found after the traversal is completed, it means that the log sequence numbers of all the basic page data linked lists are greater than the reference sequence number. Then insert the page mirror data to be stored in front of the basic page data linked list with the smallest log sequence number.

[0092] Step S203: Obtain all the preset locks of the global page data linked list. Then execute Step S204. Specifically, if there is no basic page data linked list in the global page data linked list, it means that there is no basic connection node for the page data linked list to be stored within the log sequence numbers of the available preset locks. Then, in one case, the page data linked list to be stored may need to be connected to the page data linked lists within the log sequence numbers of other preset locks. To avoid conflicts caused by other storage tasks being executed within the log sequence numbers of other preset locks and to increase the task priority of the page data linked list to be stored, all preset locks are obtained, that is, only the page data linked list to be stored can execute the task of being stored in the global page data linked list.

[0093] For example, the log sequence number range of the available preset locks is (5, 10], and there is no page data linked list stored in the global page data linked list within this range. The log sequence number range of a used preset lock is (0, 5], and the global page data linked list has stored the page data linked lists with log sequence numbers 3 and 4. The log sequence number of the page data linked list to be stored is 7, and it needs to be connected after the page data linked list with log sequence number 4. If the page data linked list with log sequence number 5 is also storing data into the global page data linked list at this time, it may cause confusion in the connection between the page data linked list with log sequence number 7 and the page data linked list with log sequence number 5.

[0094] In another case, the global page data linked list may be empty, that is, there is no page data linked list stored. Then the page data linked list to be stored does not need to be connected to other page data linked lists. However, to ensure that only the page data mirror to be stored can execute the task of being stored in the global page data linked list, all preset locks are also obtained.

[0095] Step S204: Check whether the global page data linked list is empty. If it is, execute Step S205; if not, execute Step S206. Specifically, it is to check whether there is already a page data linked list stored in the global page data linked list.

[0096] Step S205: Store the page data linked list to be stored into the global page data linked list. If the global page data linked list is empty, that is, there is no page data linked list in the global page data linked list, then there is no need to consider the issue of connection nodes, so the page data linked list to be stored can be directly stored into the global page data linked list.

[0097] Step S206: Find the first page data linked list in the global page data linked list from the back forward whose log sequence number is less than the reference sequence number.

[0098] Step S207: Connect the page data linked list to be stored behind the first page data linked list whose log sequence number is less than the reference sequence number.

[0099] Specifically, traverse the global page data linked list from the back to the front until the first page data linked list with a log sequence number less than the reference sequence number is found, indicating that the position behind this page data linked list is the correct position for the page data linked list to be stored. Connecting the page data linked list to be stored behind the first page data linked list with a log sequence number less than the reference sequence number can ensure that the page data linked list to be stored is correctly connected in the global page data linked list in ascending order of the log sequence number.

[0100] In the solution of this embodiment, by obtaining the database log including the assembly linked list and the page data linked list, reading and recording the log sequence number of the database log, denoted as the reference sequence number, obtaining the page data linked list of the database log, denoted as the page data linked list to be stored, obtaining the available preset lock of the preset global page data linked list, and storing the page data linked list to be stored in the global page data linked list in ascending order of the log sequence number according to the reference sequence number. That is to say, the page data linked list in the database log is separated from the database log and stored separately in the global page data linked list. That is to say, the page mirror data of the database log and other data except the page mirror data can be written into the cache separately. Then, in the subsequent disk writing process, the page mirror data in the database log and other data except the page mirror data can be disk-written separately. Therefore, when this database synchronizes the database log to other standby databases, it can synchronize only other data except the page mirror data, thereby reducing the data synchronization volume between the primary and standby databases and helping to improve the synchronization efficiency. Moreover, the page mirror data of the database log is still stored on the disk, which can also ensure the security and stability of this database.

[0101] Furthermore, by storing the page data linked list to be stored in the global page data linked list in ascending order of the log sequence number according to the reference sequence number, the page data linked lists in the global page data linked list are connected in sequence in ascending order of the log sequence number. In the subsequent disk writing stage, there is no need to perform additional sorting work on the global page data linked list, reducing the working pressure in the disk writing stage and improving the disk writing efficiency.

[0102] In addition, because it is necessary to store in the global page data linked list in ascending order of the log sequence number, on the one hand, in the case of only one lock or no lock, the page data linked lists can only be strictly stored in the global page data linked list one by one. That is, before one page data linked list is completely stored, other page data linked lists cannot be stored in the global page data linked list. On the other hand, as the page data linked lists are continuously stored in the global page data linked list, the global page data linked list will become very long, which may cause the time to search the global page data linked list to become very long. The above two aspects will limit the storage efficiency of the page data linked list.

[0103] Therefore, by pre-configuring a preset number of preset locks for the global page data linked list, each preset lock is bound to a range of log sequence numbers, so that different page data linked lists within the range of log sequence numbers of different preset locks can each obtain the preset locks within their respective ranges, thereby performing the task of storing into the global page data linked list without interference. On the basis of ensuring that the page data linked lists in the global page data linked list are connected in sequence, the concurrency of storing the page data linked list into the global page data linked list is improved, which further helps to improve the storage efficiency of the page data linked list into the global page data linked list.

[0104] Furthermore, by checking whether the basic page data linked list already exists in the global page data linked list, in the case of non-existence, all the preset locks of the global page data linked list are obtained, and then the page data linked list to be stored is stored into the global page data linked list. In the case where the page data linked list to be stored needs to be connected to the page data linked list within the range of log sequence numbers of other preset locks, the situation of conflicts caused by other preset locks also executing storage tasks within the range of log sequence numbers can be avoided.

[0105] As Figure 10 shown, in one embodiment, before the step of obtaining the available preset locks of the preset global page data linked list, it includes: detecting whether there are available preset locks among the preset locks already used in the global page data linked list. If so, execute the step of obtaining the available preset locks of the preset global page data linked list; if not, determine the required new range of log sequence numbers according to the first preset rule, and refer to the serial numbers within the new range of log sequence numbers; obtain a preset lock from the unused preset locks of the global page data linked list, denoted as the preset lock to be assigned; bind the new range of log sequence numbers to the preset lock to be assigned to make it an available preset lock; where the preset locks already used refer to the preset locks to which the range of log sequence numbers has been bound, and the unused preset locks refer to the preset locks to which the range of log sequence numbers has not been bound.

[0106] Exemplarily, if the global page data linked list has 8 preset locks, 3 of which have been bound to the range of log sequence numbers and 5 have not been bound to the range of log sequence numbers, then there are 3 preset locks already used and 5 unused preset locks.

[0107] In this embodiment, the method for processing database logs generally includes:

[0108] Step S301, obtain the database log. The database log is pre-assembled into a structure composed of an assembled linked list and a page data linked list connected after the assembled linked list.

[0109] Step S302, read and record the log sequence number of the database log, denoted as the reference sequence number.

[0110] Step S303, obtain the page data linked list of the database log, denoted as the page data linked list to be stored.

[0111] Step S304: Detect whether there is an available preset lock among the preset locks used in the global page data linked list. If so, execute Step S308; if not, execute S305. Specifically, it is to detect whether the reference sequence number is within the log sequence number range of a used preset lock.

[0112] Step S305: Determine the required new log sequence number range according to the first preset rule, and the reference sequence number is within the new log sequence number range. If there is no available preset lock among the used preset locks, that is, the log sequence number of the page data linked list to be stored is not within the log sequence number range of the used preset locks, then a new range of preset locks needs to be configured for the page data linked list to be stored. At this time, it is necessary to first determine the new log sequence number range that contains the log sequence number of the page data linked list to be stored.

[0113] Refer to Figure 11 As shown, specifically, this step includes:

[0114] Step S401: Obtain the maximum value among the log sequence number ranges bound by all the used preset locks of the global page data linked list, denoted as the first sequence number. Specifically, it is to find the maximum value from the log sequence number ranges bound by all the used preset locks.

[0115] Step S402: Judge whether the difference between the reference sequence number and the first sequence number is greater than the preset threshold. If so, execute Step S403; if not, execute Step S404. Specifically, the preset threshold is a modifiable preset value. After finding the first sequence number, subtract the first sequence number from the reference sequence number to get the difference between the two, and compare this difference with the preset threshold to judge whether the difference is greater than the preset threshold.

[0116] Step S403: Determine that the new log sequence number range is greater than the first sequence number and less than or equal to the reference sequence number. If the difference between the reference sequence number and the first sequence number is greater than the preset threshold, the new log sequence number range is greater than the first sequence number and less than or equal to the reference sequence number.

[0117] Step S404: Determine that the new log sequence number range is greater than the first sequence number and less than or equal to the first sequence number plus the preset threshold. If the difference between the reference sequence number and the first sequence number is not greater than the preset threshold, the new log sequence number range is greater than the first sequence number and less than or equal to the first sequence number plus the preset threshold.

[0118] Exemplarily, the preset threshold is 4, and there are two used preset locks in the global page data linked list. The log sequence number ranges bound by the two used preset locks are (0, 5] and (5, 10] respectively.

[0119] If the log sequence number of the linked list of page data to be stored, i.e., the reference sequence number, is 15, then the range of the newly added log sequence number needs to be determined. The maximum value among the ranges of log sequence numbers bound by two used preset locks is the first sequence number, which is 10. The difference between the reference sequence number and the first sequence number is 5, which is greater than the preset threshold of 4. Then the range of the newly added log sequence number is (10, 15], that is, greater than the first sequence number and less than or equal to the reference sequence number.

[0120] If the log sequence number of the linked list of page data to be stored, i.e., the reference sequence number, is 13, then the range of the newly added log sequence number needs to be determined. The maximum value among the ranges of log sequence numbers bound by two used preset locks is the first sequence number, which is 10. The difference between the reference sequence number and the first sequence number is 3, which is less than the preset threshold of 4. Then the range of the newly added log sequence number is (10, 14], that is, greater than the first sequence number and less than or equal to the first sequence number plus the preset threshold.

[0121] Step S306: Obtain a preset lock from the unused preset locks in the global linked list of page data, denoted as the preset lock to be assigned. Specifically, it is to obtain one from the preset locks in the global linked list of page data that have not been bound with the range of log sequence numbers.

[0122] Step S307: Bind the range of the newly added log sequence number to the preset lock to be assigned to make it an available preset lock. Since the log sequence number of the linked list of page data to be stored is within the range of the newly added log sequence number, after binding the range of the newly added log sequence number to the preset lock to be assigned, there will be an available preset lock.

[0123] Step S308: Obtain the available preset lock of the global linked list of page data. Thus, the available preset lock is obtained, and subsequently, the work of storing the linked list of page data to be stored into the global linked list of page data can be performed.

[0124] By setting the preset threshold, after obtaining the first sequence number, it is judged whether the difference between the reference sequence number and the first sequence number is greater than the preset threshold. When it is not greater than the preset threshold, the range of the newly added log sequence number is determined to be greater than the first sequence number and less than or equal to the first sequence number plus the preset threshold. Compared with directly determining the range of the newly added log sequence number to be greater than the first sequence number and less than or equal to the reference sequence number, it can avoid the range of the newly added log sequence number being too small, resulting in frequent acquisition of preset locks and having an adverse impact on the processing efficiency.

[0125] It should be noted that the steps not detailed in this embodiment refer to those described above.

[0126] It should be noted that in some other embodiments, the range of the newly added log sequence number can also be directly determined to be greater than the first sequence number and less than or equal to the reference sequence number without setting a preset threshold and without judgment.

[0127] As Figure 12 shown, in one embodiment, before the step of obtaining a pre-set lock from the unused pre-set locks in the global page data linked list, it includes: determining whether there are still unused pre-set locks in the global page data linked list; if so, performing the step of obtaining a pre-set lock from the unused pre-set locks in the global page data linked list; if not, finding two used pre-set locks with the smallest maximum value of the bound log sequence number range from the used pre-set locks, denoted as the first pre-set lock to be modified and the second pre-set lock to be modified, where the maximum value of the log sequence number range of the first pre-set lock to be modified is less than the maximum value of the log sequence number range of the second pre-set lock to be modified; modifying the maximum value of the log sequence number range of the first pre-set lock to be modified to the maximum value of the log sequence number range of the second pre-set lock to be modified; and binding a new log sequence number range to the second pre-set lock to make it an available pre-set lock.

[0128] In this embodiment, the method for processing database logs generally includes:

[0129] Step S501, obtaining database logs. The database logs are pre-assembled into a structure consisting of an assembly linked list and a page data linked list connected after the assembly linked list.

[0130] Step S502, reading and recording the log sequence number of the database logs, denoted as the reference sequence number.

[0131] Step S503, obtaining the page data linked list of the database logs, denoted as the page data linked list to be stored.

[0132] Step S504, detecting whether there is an available pre-set lock among the used pre-set locks in the global page data linked list. If so, performing step S512; if not, performing S505.

[0133] Step S505, determining the required new log sequence number range according to the first preset rule.

[0134] Step S506, determining whether there are still unused pre-set locks in the global page data linked list. If so, performing step S507; if not, performing step S509. Specifically, it is to check whether all the pre-set locks pre-configured in the global page data linked list have been used.

[0135] Step S507, obtaining a pre-set lock from the unused pre-set locks in the global page data linked list, denoted as the pre-set lock to be assigned. Specifically, if there are still unused pre-set locks, obtain one from them.

[0136] Step S508, binding a new log sequence number range to the pre-set lock to be assigned to make it an available pre-set lock. Perform step S512.

[0137] Step S509: From the used preset locks, find the two used preset locks with the smallest maximum value among the bound log sequence number ranges, denoted as the first preset lock to be modified and the second preset lock to be modified. The maximum value of the log sequence number range of the first preset lock to be modified is less than the maximum value of the log sequence number range of the second preset lock to be modified. Specifically, each used preset lock corresponds to a maximum value for the bound log sequence number range. Obtain the maximum values of the log sequence number ranges bound by all used preset locks, and then find the two smallest maximum values from all the maximum values. The preset locks corresponding to the log sequence number ranges of the two smallest maximum values are the first preset lock to be modified and the second preset lock to be modified. And the maximum value of the log sequence number range of the first preset lock to be modified is less than the maximum value of the log sequence number range of the second preset lock to be modified.

[0138] Step S510: Modify the maximum value of the log sequence number range of the first preset lock to be modified to the maximum value of the log sequence number range of the second preset lock to be modified. Specifically, that is to modify the log sequence number range bound by the first preset lock to be modified so that it includes the log sequence number range of the second preset lock to be modified.

[0139] Step S511: Bind a new log sequence number range to the second preset lock to be modified to make it an available preset lock. Then execute Step S512.

[0140] Step S512: Obtain the available preset locks in the global page data linked list. Thus, the available preset locks are obtained, and subsequently, the work of storing the page data linked list to be stored into the global page data linked list can be performed.

[0141] Exemplarily, it is determined that the newly added log sequence number range is (10, 15]. There are only two preset locks in the global page data linked list and both are used, with the bound log sequence number ranges being (0, 5] and (5, 10] respectively. Then the log sequence number range of the first preset lock to be modified is (0, 5], and the log sequence number range of the second preset lock to be modified is (5, 10]. Then, modify the log sequence number range of the first preset lock to be modified to (0, 10], and the log sequence number range of the second preset lock to be modified to (10, 15].

[0142] By modifying the ranges of the used preset locks when there are no unused preset locks in the global page data linked list, available preset locks can be obtained without waiting for the used preset locks to become available, thereby improving the processing efficiency.

[0143] It should be noted that in some other embodiments, if no unused preset lock can be obtained, it can be continuously looped to obtain until a preset lock becomes unused and then proceed. Or, a new lock can also be created.

[0144] It should be noted that the detailed steps of this embodiment refer to those described above.

[0145] As Figure 13 shown, in one embodiment, before the step of detecting whether there is an available preset lock among the preset locks used in the global page data linked list, it includes: detecting whether there is a used preset lock in the global page data linked list. If so, execute the step of detecting whether there is an available preset lock among the preset locks used in the global page data linked list; if not, determine the required range of new added log sequence numbers according to the second preset rule, and the reference sequence number is within the range of the new added log sequence numbers; obtain a preset lock; bind the range of new added log sequence numbers to the preset lock to make it an available preset lock.

[0146] In this embodiment, the method for processing database logs generally includes:

[0147] Step S601, obtain the database log. The database log is pre-assembled into a structure composed of an assembly linked list and a page data linked list connected after the assembly linked list.

[0148] Step S602, read and record the log sequence number of the database log, denoted as the reference sequence number.

[0149] Step S603, obtain the page data linked list of the database log, denoted as the to-be-stored page data linked list.

[0150] Step S604, detect whether there is a used preset lock in the global page data linked list. If so, execute step S608; if not, execute step S605. That is, detect whether there is a preset lock in the global page data linked list that has been bound with a log sequence number range.

[0151] Step S605, determine the required range of new added log sequence numbers according to the second preset rule, and the reference sequence number is within the range of the new added log sequence numbers. Specifically, if there is no used preset lock in the global page data linked list, that is, all the preset locks in the global page data linked list have not been bound with log sequence number ranges. That is, there is no available preset lock, then a new range of preset locks needs to be configured for the to-be-stored page data linked list. At this time, it is necessary to first determine the range of new added log sequence numbers that contains the log sequence number of the to-be-stored page data linked list.

[0152] Refer to Figure 14 shown, this step includes:

[0153] Step S701, obtain the log sequence number corresponding to the currently last database log written to disk, denoted as the second sequence number. Specifically, that is, the log sequence number of the currently last database log written to disk.

[0154] Step S702, determine whether the difference between the reference serial number and the second serial number is greater than a preset threshold. If so, execute Step S703; if not, execute Step S704.

[0155] Step S703, determine that the range of the newly added log serial numbers is greater than the second serial number and less than or equal to the reference serial number.

[0156] Step S704, determine that the range of the newly added log serial numbers is greater than the second serial number and less than or equal to the second serial number plus the preset threshold.

[0157] Specifically, the specific execution manners of Step S702 to Step S704 refer to those described in Step S402 to Step S404 in the foregoing text, and will not be elaborated here.

[0158] Step S606, obtain a preset lock. Since all the preset locks of the global page data linked list are in the unused state, a preset lock can be directly obtained therefrom.

[0159] Step S607, bind the range of the newly added log serial numbers to the preset lock to make it an available preset lock. Since the log serial numbers of the page data linked list to be stored are within the range of the newly added log serial numbers, after binding the range of the newly added log serial numbers to the preset lock, there will be an available preset lock. Execute Step S616.

[0160] Step S608, detect whether there is an available preset lock among the used preset locks of the global page data linked list. If so, execute Step S616; if not, execute S609.

[0161] Step S609, determine the required range of the newly added log serial numbers according to the first preset rule.

[0162] Step S610, determine whether the global page data linked list still has unused preset locks. If so, execute Step S611; if not, execute Step S613.

[0163] Step S611, obtain a preset lock from the unused preset locks of the global page data linked list, and denote it as the preset lock to be assigned.

[0164] Step S612, bind the range of the newly added log serial numbers to the preset lock to be assigned to make it an available preset lock. Execute Step S616.

[0165] Step S613, find the two used preset locks with the smallest maximum value of the bound log serial number ranges from the used preset locks, and denote them as the first preset lock to be modified and the second preset lock to be modified. The maximum value of the log serial number range of the first preset lock to be modified is less than the maximum value of the log serial number range of the second preset lock to be modified.

[0166] Step S614, modify the maximum value of the log sequence number range of the first preset lock to be modified to the maximum value of the log sequence number range of the second preset lock to be modified. Specifically, that is to modify the log sequence number range bound to the first preset lock to be modified so that it includes the log sequence number range of the second preset lock to be modified.

[0167] Step S615, bind a new log sequence number range to the second preset lock to be modified to make it an available preset lock. Execute Step S616.

[0168] Step S616, obtain the available preset locks in the global page data linked list.

[0169] It should be noted that the steps not detailed in this embodiment refer to those described above.

[0170] As Figure 15 shown, in one embodiment, after the step of storing the page data linked list to be stored in the global page data linked list in ascending order of the log sequence number according to the reference sequence number, the processing method of the database log generally includes:

[0171] Step S801, release the preset locks in the global page data linked list. Specifically, after the page data linked list to be stored completes the storage task in the global page data linked list, release all the preset locks obtained during the storage process.

[0172] Step S802, store the assembled linked list part of the database log into the log buffer. Specifically, allocate a storage location in the log buffer according to the length of the assembled linked list part, that is, allocate a storage location in the log buffer according to the length of the database log after removing the page data linked list, and store the assembled linked list part of the database log into the location allocated for it in the log buffer. Thus, an entire database log is written into the cache.

[0173] It should be noted that this step has no strict sequence relationship with the step of storing the page data linked list into the global page data linked list.

[0174] As Figure 16 shown, in one embodiment, the processing method of the database log generally further includes:

[0175] Step S901, detect the start signal for flushing the database log in the cache. Specifically, the start signal can be a signal that is triggered every fixed time, or it can also be a signal that is triggered after the amount of database log data in the cache reaches a certain threshold, etc. Simply put, it is to detect that it is necessary to perform the flushing work on the database log in the cache.

[0176] Step S902: Obtain the database logs in the cache that meet the preset disk-writing rules, which are denoted as disk-writable logs. Specifically, the database logs that meet the preset disk-writing rules are at least one database log that has been completely written into the cache and whose log sequence numbers are consecutive starting from the log sequence number of the last database log completed in the previous disk-writing. A database log that has been completely written into the cache is a database log for which the assembled linked list part has fallen into the log cache area and the page data linked list has been stored in the global page data linked list.

[0177] Specifically, the preset disk-writing rules can be configured such that all database logs whose log sequence numbers are consecutive starting from the log sequence number of the last database log completed in the previous disk-writing are regarded as the disk-writable database logs for this time, or it can also be configured such that a set number (such as one, two, ten, one hundred, etc.) of database logs whose log sequence numbers are consecutive starting from the log sequence number of the last database log completed in the previous disk-writing are regarded as the disk-writable database logs for this time.

[0178] Exemplarily, if the database logs with log sequence numbers 3, 4, 5, 8, 9 (the numbers are only for illustration and do not represent actual complete log sequence numbers) are completely stored in the current cache, and the log sequence number of the last database log completed in the previous disk-writing is 2.

[0179] Taking the preset disk-writing rules as configured such that all database logs whose log sequence numbers are consecutive starting from the log sequence number of the last database log completed in the previous disk-writing are regarded as the disk-writable database logs for this time: starting from 2, 3, 4, and 5 are the database logs whose log sequence numbers are consecutive. Since 6 and 7 are missing between 5 and 8, they are no longer consecutive. Then the database logs with log sequence numbers 3, 4, and 5 meet the preset disk-writing rules.

[0180] Taking the preset disk-writing rules as configured such that two database logs whose log sequence numbers are consecutive starting from the log sequence number of the last database log completed in the previous disk-writing are regarded as the disk-writable database logs for this time: starting from 2, 3 and 4 are the database logs whose log sequence numbers are consecutive.

[0181] Step S903: Find the corresponding page data linked list from the global page data linked list according to the log sequence numbers of the disk-writable logs, which is denoted as the disk-writable page data linked list. Specifically, after determining the disk-writable logs, find the corresponding page data linked list from the global page data linked list according to the log sequence numbers.

[0182] Step S904: Copy the page mirror data in the diskable page data linked list to the end of a preset page mirror data storage table in sequence according to the connection order. Specifically, a page mirror data storage table is pre-created in the disk. After obtaining the diskable page mirror data, copy the page mirror data in the diskable page data linked list to the page mirror data storage table in sequence according to the connection order.

[0183] As shown in Figure 17 the figure, it is an example of a page mirror data storage table. Since the page data linked list was stored in the global page data linked list in the order of log sequence numbers before, directly copy the page mirror data in the diskable page data linked list to the end of the storage table in sequence according to the connection order. The page mirror data will definitely be arranged in the order of log sequence numbers in the page mirror data storage table.

[0184] Step S905: Partially flush the assembled linked list of diskable logs. Specifically, it means flushing the assembled linked list of database logs in the log buffer. Thus, the page data linked list and the assembled linked list of database logs that need to be flushed in this flushing operation are both flushed, that is, the complete database logs are flushed.

[0185] It should be noted that there is no strict sequence relationship between this step and the step of putting the page mirror data into the page mirror data storage table.

[0186] Further, after the step of copying the page mirror data in the diskable page data linked list to the end of a preset page mirror data storage table in sequence according to the connection order, it includes:

[0187] Step S906: Remove the diskable page data linked list from the global page data linked list. Specifically, it means deleting the page data linked list that has been flushed in the global page data linked list, so as to free up storage space.

[0188] In addition, if it is detected that the log sequence number ranges of a certain preset lock in the global page data linked list correspond to all page data linked lists that have been flushed, recycle the preset lock, that is, the preset lock returns to the unused state without binding a log sequence number range for reuse.

[0189] In the solution of this embodiment, by storing the page mirror data in the page mirror data storage table, since the database can manage and search the table more conveniently, the management convenience of the page mirror data in the disk can be improved. And since the page data linked list was stored in the global page data linked list in the order of log sequence numbers before, the page mirror data can be directly put into the end of the page mirror data storage table without sorting during the flushing stage, with high efficiency.

[0190] 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 disclosed content 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 to cover all such other variations or modifications.

Claims

1. A method for processing database logs, comprising: Obtaining a database log, where the database log is pre-assembled into a structure composed of an assembly linked list and a page data linked list connected after the assembly linked list. The page data linked list is a linked list composed of page mirror data in the database log, and the assembly linked list is a linked list composed of other data except page mirror data in the database log; Reading and recording the log sequence number of the database log, denoted as the reference sequence number; Obtaining the page data linked list of the database log, denoted as the to-be-stored page data linked list; Obtaining an available preset lock for the global page data linked list. Wherein, the global page data linked list is used to store page data linked lists, and the global page data linked list is pre-configured with a preset number of preset locks, and each preset lock can bind a range of log sequence numbers. The available preset lock is a preset lock whose bound log sequence number range includes the reference sequence number; Storing the to-be-stored page data linked list into the global page data linked list in ascending order of log sequence numbers according to the reference sequence number, so that the page data linked lists in the global page data linked list are connected in ascending order of log sequence numbers in sequence.

2. The method for processing a database log according to claim 1, wherein, Before the step of obtaining an available preset lock for the preset global page data linked list, it includes: Detecting whether there is the available preset lock among the preset locks already used in the global page data linked list. If so, performing the step of obtaining an available preset lock for the preset global page data linked list; If not, determining the required new log sequence number range according to the first preset rule, and the reference sequence number is within the new log sequence number range; Obtaining a preset lock from the unused preset locks of the global page data linked list, denoted as the to-be-assigned preset lock; Binding the new log sequence number range to the to-be-assigned preset lock to make it the available preset lock; Wherein, the already used preset lock refers to a preset lock that has bound a log sequence number range, and the unused preset lock refers to a preset lock that has not bound a log sequence number range.

3. The method for processing a database log according to claim 2, wherein The step of determining the required new log sequence number range according to the first preset rule includes: Obtaining the maximum value among the log sequence number ranges bound by all the already used preset locks of the global page data linked list, denoted as the first sequence number; Determining the new log sequence number range as greater than the first sequence number and less than or equal to the reference sequence number.

4. The method for processing database logs according to claim 3, wherein, Before the step of determining the new log sequence number range as greater than the first sequence number and less than or equal to the reference sequence number, it includes: Judging whether the difference between the reference sequence number and the first sequence number is greater than a preset threshold. If so, performing the step of determining the new log sequence number range as greater than the first sequence number and less than or equal to the reference sequence number. If not, determining the new log sequence number range as greater than the first sequence number and less than or equal to the first sequence number plus the preset threshold.

5. The method for processing database logs according to claim 2, wherein, Before the step of obtaining a preset lock from the unused preset locks of the global page data linked list, it includes: Judging whether the global page data linked list still has unused preset locks; If so, execute the step of obtaining a preset lock from the unused preset locks in the global page data linked list; If not, find two used preset locks with the smallest maximum value of the bound log sequence number range from the used preset locks, denoted as the first preset lock to be modified and the second preset lock to be modified, where the maximum value of the log sequence number range of the first preset lock to be modified is less than the maximum value of the log sequence number range of the second preset lock to be modified; Modify the maximum value of the log sequence number range of the first preset lock to be modified to the maximum value of the log sequence number range of the second preset lock to be modified; Bind the new log sequence number range to the second preset lock to be modified to make it the available preset lock.

6. The method for processing a database log according to claim 2, wherein, Before the step of detecting whether there is the available preset lock in the used preset locks of the global page data linked list, it includes: Detect whether there is a used preset lock in the global page data linked list. If so, execute the step of detecting whether there is the available preset lock in the used preset locks of the global page data linked list; If not, determine the required new added log sequence number range according to the second preset rule, and the reference sequence number is within the new added log sequence number range; Obtain one of the preset locks; Bind the new added log sequence number range to the preset lock to make it the available preset lock.

7. The method for processing a database log according to claim 6, wherein, The step of determining the required new added log sequence number range according to the second preset rule includes: Obtain the log sequence number corresponding to the currently last disk-written database log, denoted as the second sequence number; Determine that the new added log sequence number range is greater than the second sequence number and less than or equal to the reference sequence number.

8. The method for processing a database log according to claim 7, wherein, Before the step of determining that the new added log sequence number range is greater than the second sequence number and less than or equal to the reference sequence number, it includes: Judge whether the difference between the reference sequence number and the second sequence number is greater than the preset threshold. If so, execute the step of determining that the new added log sequence number range is greater than the second sequence number and less than or equal to the reference sequence number. If not, determine that the new added log sequence number range is greater than the second sequence number and less than or equal to the second sequence number plus the preset threshold.

9. The method for processing a database log according to claim 1, wherein, The step of storing the to-be-stored page data linked list into the global page data linked list in ascending order of the log sequence number according to the reference sequence number includes: Check whether there is a basic page data linked list in the global page data linked list. The basic page data linked list is the page data linked list within the log sequence number range of the available preset lock; If so, connect the to-be-stored page data linked list and the basic page data linked list in ascending order of the log sequence number according to the reference sequence number; If not, obtain all the preset locks of the global page data linked list; Find the first page data linked list with a log sequence number less than the reference sequence number from back to front in the global page data linked list, and connect the to-be-stored page data linked list behind the first page data linked list with a log sequence number less than the reference sequence number.

10. The method for processing a database log according to claim 9, wherein, Before the step of finding, from back to front in the global page data linked list, the page data linked list whose first log sequence number is less than the reference sequence number, the following steps are included: Check whether the global page data linked list is empty. If it is, store the page data linked list to be stored into the global page data linked list. If not, execute the step of finding, from back to front in the global page data linked list, the page data linked list whose first log sequence number is less than the reference sequence number.