Database processing method, storage medium and equipment

By separating and constructing page mirror data in the database, the performance bottlenecks and recovery failures during the database synchronization process are solved, and efficient and reliable database recovery is achieved.

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

Patent Information

Application Number
CN202311865059.2
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 main database generates a large number of XLOG logs when business pressure is high, resulting in the synchronous stream replication mode becoming a performance bottleneck. When page mirror data is lost, page breaks and recovery failures may occur during the recovery process, which cannot guarantee the correctness of the recovery.

Method used

Separate the page mirror data in the transaction log, and construct the page mirror file on disk. Reconstruct the page mirror data by assembling the linked list and data link list structure, and use the page mirror file to repair incomplete data pages to ensure the integrity of the transaction log.

Benefits of technology

Improves the efficiency and reliability of database recovery, avoids recovery from basic backup, reduces the risk of recovery failure, and ensures the correctness and consistency of transaction logs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120276913A_ABST
    Figure CN120276913A_ABST
Patent Text Reader

Abstract

The invention provides a database processing method, a storage medium and equipment, a transaction log of a database is set to be of a structure composed of an assembly linked list and a data linked list connected behind the assembly linked list, and the data linked list is a linked list composed of page mirror image data separated from the transaction log. The assembled chain table is a chain table formed by other data except page mirror image data in the transaction log. The processing method comprises the following steps: reading a to-be-remade transaction log; checking whether head information of the page mirror image data exists in the transaction log or not; if yes, searching a corresponding data page from a disk according to the head information of the page mirror image data; reconstructing page mirror image data by utilizing the searched data pages; and adding the page mirror image data into the data chain table of the transaction log. The method has the advantages that in the process of recovering the database by using the transaction log, the missing page mirror image data is constructed, so that recovery can be continued at the recovery failure position after the situation of recovery failure occurs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data synchronization, and in particular, to a processing method, a storage medium, and a device for a database. Background Art

[0002] Database clusters usually adopt the synchronous streaming replication mode to keep the data of the primary and standby databases strictly consistent. However, when the business pressure on the primary database is large, a large number of XLOG logs will be generated. At this time, the synchronous streaming replication mode is likely to become a performance bottleneck of the database.

[0003] To solve the above problems, the page mirror data (page data) of the transaction log can be separated and continuously stored in the page mirror file, and then the disk write I / O of a large number of small and random page mirror files can be transformed into fewer and sequential disk write I / Os to improve the disk write efficiency of the page data of the XLOG.

[0004] The inventors have recognized that when the separated page mirror data is lost (such as planned cleaning, misoperation, etc.), page breaks may occur during the replay of the XLOG log and the corresponding page data file cannot be found. In this way, it is necessary to start the recovery from the latest base backup. However, when the base backup is far from the target recovery point, the recovery may fail midway, and the recovery failure may introduce newly broken pages. Since the page mirror data is missing in the XLOG log, it is impossible to ensure the correctness of continuing the recovery at the recovery failure point, so there is still room for improvement.

[0005] The above information disclosed in this background art is only used to increase the understanding of the background art of the present application. Therefore, it may include prior art that is not known to those of ordinary skill in the art. Summary of the Invention

[0006] In view of the above problems, the present invention provides a processing method, a storage medium, and a device for a database that can overcome or partially solve the above problems.

[0007] An object of the first aspect of the present invention is to reconstruct page mirror data using data pages in the disk so that transaction logs can be reused.

[0008] Another object of the first aspect of the present invention is to repair page mirror data using page mirror files when the data pages are incomplete.

[0009] In particular, according to the first aspect of the present invention, the present invention provides a method for processing a database, wherein the transaction log of the database is set to have a structure composed of an assembled linked list and a data linked list connected after the assembled linked list. Among them, the data linked list is a linked list composed of page mirror data separated from the transaction log, and the assembled linked list is a linked list composed of other data in the transaction log except the page mirror data. The processing method includes:

[0010] Read a transaction log to be redone;

[0011] Check whether there is header information of page mirror data in the transaction log;

[0012] If it exists, find the corresponding data page from the disk according to the header information of the page mirror data;

[0013] Reconstruct the page mirror data by using the found data page;

[0014] Add the page mirror data to the data linked list of the transaction log.

[0015] Optionally, after the step of finding the corresponding data page from the disk according to the header information of the page mirror data, it further includes:

[0016] Check whether the data page is complete;

[0017] If it is complete, execute the step of reconstructing the page mirror data by using the found data page.

[0018] Optionally, after the step of checking whether the data page is complete, it further includes:

[0019] If it is incomplete, repair the incomplete data page.

[0020] Optionally, the step of repairing the incomplete data page includes:

[0021] Construct a file name by using the table position, block number of the page mirror data corresponding to the data page in the disk and the log number of the transaction log;

[0022] Check whether there is a page mirror file with the same name as the file name in the disk;

[0023] If it exists, repair the data page by using the page mirror data in the page mirror file.

[0024] Optionally, after the step of adding the page mirror data to the data linked list of the transaction log, it further includes:

[0025] Successively write the page mirror data and the data page corresponding to the page mirror data to disk.

[0026] Optionally, the steps of successively writing the page mirror data and the data pages corresponding to the page mirror data to disk include:

[0027] Checking whether there is corresponding page mirror data for the data page to be written to disk in the data linked list;

[0028] If so, constructing a file name using the table position, block number in the disk of the page mirror data corresponding to the data page and the log number of the transaction log;

[0029] Searching whether there is a page mirror file with the same name as the file name in the disk;

[0030] If so, writing the page mirror file to disk;

[0031] Writing the data pages corresponding to the page mirror data to disk.

[0032] Optionally, after the step of writing the page mirror file to disk, it further includes:

[0033] Removing the linked list node corresponding to the page mirror data from the data linked list;

[0034] Then performing the step of writing the data pages corresponding to the page mirror data to disk.

[0035] Optionally, after the step of checking whether there is header information of page data in the transaction log, it further includes:

[0036] If not, checking whether the redo of the transaction log is completed;

[0037] If so, ending the redo process of the transaction log;

[0038] If not, reading the next transaction log to be redone.

[0039] According to the second aspect of the present invention, there is provided a machine-readable storage medium, on which a machine-executable program is stored, and when the machine-executable program is executed by a processor, any one of the above database mathematical methods is implemented.

[0040] According to the third aspect of the present invention, there is provided a computer device, including 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, any one of the above database processing methods is implemented.

[0041] The processing method of the database of the present invention first reads a transaction log to be redone, then checks whether there is header information of page mirror data in the transaction log. If it exists, it indicates that the transaction log originally contained page mirror data. Then, according to the header information of the page mirror data, the corresponding data page is searched for on the disk, and the page mirror data is reconstructed using the found data page. Finally, the page mirror data is added to the data linked list of the transaction log. Thus, the missing page mirror data can be added back, enabling the header information of the page mirror data in the transaction log to be reused.

[0042] Further, in the processing method of the database of the present invention, when repairing an incomplete data page, a file name is first constructed using the table position, block number in the disk, and log number of the transaction log corresponding to the data page. Then, it is checked whether there is a page mirror file with the same name as the constructed file name on the disk. If it exists, it indicates that the page mirror data has been written to the page mirror file on the disk. Thus, the page mirror data in the page mirror file can be used to repair the data page.

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

[0044] By reading the following detailed description of the preferred embodiments, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to be a limitation of the present invention. Moreover, throughout the drawings, the same reference numerals are used to represent the same components. In the drawings:

[0045] Figure 1 is a schematic structural diagram of a transaction log according to an embodiment of the present invention;

[0046] Figure 2 is a schematic structural diagram of a linked list node in a data linked list according to an embodiment of the present invention;

[0047] Figure 3 is a schematic diagram of the processing method of a database according to an embodiment of the present invention;

[0048] Figure 4 is a schematic structural diagram of inserting a linked list node according to an embodiment of the present invention;

[0049] Figure 5 is a schematic structural diagram of constructing a file name according to an embodiment of the present invention;

[0050] Figure 6 is a schematic structural diagram of deleting a linked list node according to an embodiment of the present invention;

[0051] Figure 7 Schematic structural diagram of the recovery range of a transaction log according to an embodiment of the present invention;

[0052] Figure 8 Schematic structural diagram of the recovery range of a transaction log according to another embodiment of the present invention;

[0053] Figure 9 Flowchart of a database processing method according to an embodiment of the present invention;

[0054] Figure 10 Schematic diagram of a machine-readable storage medium according to an embodiment of the present invention;

[0055] Figure 11 Schematic diagram of a computer device according to an embodiment of the present invention. Detailed implementation manners

[0056] 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 the embodiments of the present invention. This part of the embodiments is intended to explain the technical principle 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 should still fall within the protection scope of the present invention.

[0057] 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 in combination with these instruction execution systems, apparatuses, or devices.

[0058] In a database, the transaction log actually refers to the XLOG log, also called the WAL (write ahead log) log. A very important function of the XLOG log is to be used to build a primary and standby database cluster. When the primary machine fails, the standby machine can immediately become the primary and take over the primary machine to continue providing services externally.

[0059] Figure 1 Schematic structural diagram of a transaction log according to an embodiment of the present invention. As Figure 1 shown, the transaction log can include two parts: a file header and a data area. Among them:

[0060] At the very front of the file header is an XLogRecord structure. If there are blocks or main data sections in the XLOG, then there are corresponding header information for the blocks or main data sections after the XLogRecord accordingly.

[0061] The data area can be divided into blocks and main data sections. There may be multiple block areas in the blocks section, and each block area may contain page data and tuple-related data.

[0062] In the present invention, a page mirror file, i.e., a page data file, can be pre-created in the database. During the assembly stage of the XLOG, the page mirror data in the XLOG (i.e., the page data in the log data area) is separated and stored in the page data file. In this way, during the data synchronization process, only the other data in the XLOG except the page mirror data needs to be synchronized, making the data synchronization between the primary and standby databases more efficient.

[0063] For example, newly generated XLOG files are stored in the sys_wal directory. Create a directory (such as named wal_pagedata) under the sys_wal directory, and create a corresponding page mirror file (page data file) in the wal_pagedata directory for each page data to be retained in the XLOG. Each page data and its related data are stored in a separate page data file.

[0064] Therefore, the structure of the transaction log can be improved. In the present invention, during the assembly stage of the transaction log, the transaction log is set to have a structure composed of an assembly linked list and a data linked list connected after the assembly linked list. Among them, the data linked list is a linked list composed of the page mirror data separated from the transaction log, and the assembly linked list is a linked list composed of the other data in the transaction log except the page mirror data.

[0065] Figure 2 It is a schematic structural diagram of a linked list node of the data linked list according to an embodiment of the present invention. As Figure 2 shown, in the data linked list, the content of each linked list node is described as follows:

[0066] RelFileNode: The location information of the table to which the data page corresponding to the page mirror data belongs on the disk, which is actually an object ID.

[0067] BlockNumber: The block number in the table to which the data page belongs. BlockNumber and RelFileNode can jointly determine the position of the data page on the data disk.

[0068] page data: The page mirror data in the XLOG log.

[0069] lsn: The lsn of the XLOG log to which the page data belongs.

[0070] next: Points to the next linked list node.

[0071] It should be noted that if the page data originally exists in the transaction log, the information about the page data will be recorded in the header information of the transaction log, and this part of the information is reserved for subsequent support of block repair.

[0072] Figure 3 It is a schematic diagram of a database processing method according to an embodiment of the present invention. As Figure 3 shown, the database processing method may include the following steps S302 to step S310.

[0073] Step S302, read a transaction log to be redone.

[0074] Step S304, check whether there is header information of page mirror data in the transaction log.

[0075] Step S306, if it exists, find the corresponding data page from the disk according to the header information of the page mirror data.

[0076] Step S308, reconstruct the page mirror data by using the found data page.

[0077] Step S310, add the page mirror data to the data linked list of the transaction log.

[0078] The database processing method of this embodiment first reads a transaction log to be redone, then checks whether there is header information of page mirror data in the transaction log. If it exists, it means that the transaction log originally contained page mirror data. Then, it finds the corresponding data page from the disk according to the header information of the page mirror data, reconstructs the page mirror data by using the found data page, and finally adds the page mirror data to the data linked list of the transaction log. Thus, the missing page mirror data can be added back, enabling the header information of the page mirror data in the transaction log to be reused.

[0079] It should be noted that if there is originally page mirror data in the transaction log, there will be a record of the header information of the page mirror data in the header information of the transaction log. Therefore, it is relatively easy to determine whether a page mirror data file has been separated from the transaction log, and to find the location information of the data pages corresponding to the page mirror data file according to the header information, that is, RelFileNode and BlockNumber. RelFileNode can locate the table where the data page is located, and BlockNumber can locate the block position of the data page in the table.

[0080] In an alternative embodiment, after finding the corresponding data page from the disk according to the header information of the page mirror data, it is also possible to check whether the data page is complete. If it is complete, perform the step of reconstructing the page mirror data by using the found data page.

[0081] In this way, by performing an integrity check on the found data page, it can be determined whether there are problems with the data page being incomplete or damaged, so as to avoid errors in the page mirror data reconstructed based on the data page, which is beneficial to ensuring the reliability and consistency of the page mirror data.

[0082] The data page can specifically be verified by using CRC (Cyclic Redundancy Check), and the page mirror data can be reconstructed based on the same method as in the assembly stage of the XLOG log.

[0083] Furthermore, after the step of checking whether the data page is complete, if it is found that the data page is incomplete, the incomplete data page can be repaired. Thus, it is possible to avoid recovering from the base backup, which is beneficial to saving the recovery time of the database.

[0084] In an alternative embodiment, the step of repairing the incomplete data page can be: first, construct a file name (RelFileNode_BlockNumber_lsn) by using the table location (RelFileNode), block number (BlockNumber) of the page mirror data corresponding to the data page in the disk, and the log sequence number (lsn) of the transaction log, and then check whether there is a page mirror file with the same name as this file name in the disk. If it exists, it means that the page mirror data has been previously written to the page mirror file on the disk. At this time, the page mirror data in the page mirror file can be fully utilized to repair the data page.

[0085] If a page mirror data file with the same name is found, it indicates that page mirror data has been previously written to disk in this page mirror file, and the file name of this page mirror file is exactly composed of RelFileNode, BlockNumber, and lsn in the linked list node corresponding to the page mirror data. Therefore, when searching for a file with the same name, it can be relatively easily determined by traversing all page data files in the wal_pagedata directory.

[0086] It should be noted that when the data page is incomplete, the success rate of using the page mirror data in the page mirror file to repair the data page is relatively high, that is, the probability of finding a file with the same name is relatively high, and the probability of not finding a file with the same name is relatively low, which usually only occurs when the data is severely damaged. If a file with the same name cannot be found, an error prompt can be issued, and at this time, recovery can only start from the base backup.

[0087] In an alternative embodiment, the step of adding page mirror data to the data linked list of the transaction log can be to first create a linked list node for the page mirror data, then put the page mirror data and related information into this linked list node respectively, and finally insert this linked list node at the end of the data linked list, so that the head of the XLOG log can be reused to recover the data.

[0088] Figure 4 It is a schematic structural diagram of inserting a linked list node into a data linked list according to an embodiment of the present invention. As Figure 4 shown, the form of this linked list node is the same as that of the nodes in the data linked list, and its content description is as follows:

[0089] RelFileNode: The location information of the table to which the data page corresponding to the page mirror data belongs on the disk, which is actually an object ID.

[0090] BlockNumber: The block number in the table to which the data page belongs. BlockNumber and RelFileNode can jointly determine the location of the data page on the data disk.

[0091] page data: The page mirror data of the XLOG log constructed using the data page during the recovery process.

[0092] lsn: The lsn of the XLOG log to which the page data belongs.

[0093] next: Points to the next linked list node.

[0094] In an alternative embodiment, after the step of adding page mirror data to the data linked list of the transaction log, the page mirror data and the data page corresponding to the page mirror data are written to disk in sequence.

[0095] Specifically, the steps of sequentially flushing the disk page mirror data and the data pages corresponding to the page mirror data may be as follows: first, check whether there is corresponding page mirror data for the data page to be flushed in the data linked list. If there is, construct a file name using the table position, block number, and log number of the transaction log of the page mirror data corresponding to the data page. If not, directly flush this data page to the disk and then end the process.

[0096] Further, after constructing the file name, continue to check whether there is a page mirror file with the same name in the disk. If there is a page mirror file with the same name, flush the page mirror file. In this embodiment, it can be flushed to the RelFileNode_BlockNumber_lsn file in the wal_pagedata directory of pagedata. If there is no page mirror file with the same name, ignore this disk flushing, and finally flush the data page corresponding to the page mirror data.

[0097] When flushing the data page corresponding to the page mirror data, since the page mirror data corresponding to the data page has been flushed in the previous stage, even if a page break occurs when the data page is flushed at this time, it can be repaired through the already flushed page mirror data.

[0098] Further, after the step of flushing the page mirror file, the corresponding linked list node (page mirror data) can also be removed from the data linked list, and then the step of flushing the data page corresponding to the page mirror data is executed. Removing the linked list node can make the search operation of the linked list more efficient and can save some storage space.

[0099] In an alternative embodiment, before the step of reading a transaction log to be redone, the recovery range of the transaction log can also be determined. For example, the lsn corresponding to the recovery target is denoted as recovery_target_lsn, and the starting point of recovery based on the base backup is denoted as recovery_begin_lsn. The lsn of the current XLOG log is cur_record_lsn. In this way, the recovery process of the transaction log can be understood by comparing the lsn.

[0100] In an alternative embodiment, after the step of checking whether there is header information of page data in the transaction log, if it is found that there is no header information of page data, it means that there was originally no page mirror data in this transaction log. At this time, it can be checked whether the transaction log has been redone. If so, end the redo process of the transaction log. If not, continue to read the next transaction log to be redone.

[0101] Figure 9 It is a flowchart of a processing method of a database according to an embodiment of the present invention, as Figure 9 shown, and this control method at least includes the following steps S902 to step S918.

[0102] Step S902, determine the header information of the page mirror data existing in the transaction log.

[0103] Step S904, search for the corresponding data page from the disk according to the header information of the page mirror data.

[0104] Step S906, check whether the data page is complete. If so, execute Step S908; if not, execute Step S916.

[0105] Step S908, reconstruct the page mirror data by using the found data page.

[0106] Step S910, add the page mirror data to the data linked list of the transaction log.

[0107] Step S912, sequentially write the page mirror data and the data page corresponding to the page mirror data to disk;

[0108] Step S914, repair the incomplete data page.

[0109] Step S916, determine whether the data page is successfully repaired. If so, execute Step S912; if not, execute Step S918.

[0110] In this step, the basis for judging successful repair can be finding the corresponding page mirror file. Since there is corresponding page mirror data in the page mirror file, this page mirror data can be fully used to repair this data page.

[0111] Step S918, issue an error prompt.

[0112] Adopt the processing method of the database of the present invention:

[0113] 1. It can be relatively easy to judge whether the XLOG log originally contains page data according to whether there is the header information of page data in the header information of the XLOG log.

[0114] 2. According to the header information of page data recorded in the XLOG log, using the same method as in the assembly stage of the XLOG log writing process, the complete data page can be constructed into page data, so that the header of page data in the XLOG log can be reused.

[0115] (3) Under the wal_pagedata directory, uniquely search for the page data file corresponding to the incomplete data page by using the page data file name, and the page data in the page data file can be used to repair the incomplete data page.

[0116] (4) Construct a data linked list to organize and manage the page data constructed during the database recovery process.

[0117] (5) Selectively write the page data files to disk (only write the missing page data files), which can reduce the disk I / O introduced here.

[0118] It can be understood that during the XLOG log replay process of the database recovery process, the missing page data files are all re-added. Therefore, when exiting the recovery process due to failure, the recovery can continue at the failed position. This is because the broken pages that occur during the recovery process can all be repaired through the page data files, and there is no need to start the recovery from the base backup. In this way, the recovery efficiency of the database can be significantly improved.

[0119] This embodiment also provides a machine-readable storage medium 10 and a computer device 20. Figure 10 It is a schematic diagram of the machine-readable storage medium 10 according to an embodiment of the present invention. Figure 11 It is a schematic diagram of the computer device 20 according to an embodiment of the present invention.

[0120] A machine-executable program 11 is stored on the machine-readable storage medium 10. When the machine-executable program 11 is executed by the processor 210, it implements the database processing method of any of the above embodiments.

[0121] The computer device 20 may include a memory 220, a processor 210, and a machine-executable program 11 stored on the memory 220 and running on the processor 210. When the processor 210 executes the machine-executable program 11, it implements the database processing method of any of the above embodiments.

[0122] 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 10 for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor 210, 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.

[0123] For the purposes of the description of this embodiment, the machine-readable storage medium 10 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 (a non-exhaustive list) of the computer-readable medium include the following: an electrical connection (electronic device) having one or more wirings, a portable computer diskette (magnetic device), a random access memory 220 (RAM), a read-only memory 220 (ROM), an erasable programmable read-only memory 220 (EPROM or flash memory 220), an optical fiber device, and a portable compact disc read-only memory 220 (CDROM). Additionally, the machine-readable storage medium 10 can even be paper or other suitable media on which a program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation, or, if necessary, other suitable processing, and then stored in the computer memory 220.

[0124] 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 embodiment, multiple steps or methods can be implemented by software or firmware stored in the memory 220 and executed by a suitable instruction execution system.

[0125] The computer device 20 can be, for example, a server, a desktop computer, a laptop computer, a tablet computer, or a smartphone. In some examples, the computer device 20 can be a cloud computing node. The computer device 20 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 20 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.

[0126] The computer device 20 can include a processor 210 suitable for executing stored instructions and a memory 220 that provides temporary storage space for the operation of the instructions during operation. The processor 210 can be a single-core processor 210, a multi-core processor 210, a computing cluster, or any other number of other configurations. The memory 220 can include a random access memory 220 (RAM), a read-only memory 220, a flash memory, or any other suitable storage system.

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

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

[0129] The flowcharts provided in this embodiment are not intended to indicate that the operations of the method will be performed 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 may be made to the above method.

[0130] 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 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 determined to cover all these other variations or modifications.

Claims

1. A method for processing a database, wherein the transaction log of the database is set to a structure composed of an assembled linked list and a data linked list connected after the assembled linked list, where, The data linked list is a linked list composed of page mirror data separated from the transaction log, and the assembly linked list is a linked list composed of other data in the transaction log except the page mirror data. The processing method includes: Read a transaction log to be redone; Check whether there is header information of page mirror data in the transaction log; If it exists, find the corresponding data page from the disk according to the header information of the page mirror data; Reconstruct the page mirror data by using the found data page; Add the page mirror data to the data linked list of the transaction log.

2. The processing method according to claim 1, wherein After the step of finding the corresponding data page from the disk according to the header information of the page mirror data, it further includes: Check whether the data page is complete; If it is complete, execute the step of reconstructing the page mirror data by using the found data page.

3. The processing method according to claim 2, wherein, After the step of checking whether the data page is complete, it further includes: If it is incomplete, repair the incomplete data page.

4. The processing method according to claim 3, wherein, The step of repairing the incomplete data page includes: Construct a file name by using the table position, block number in the disk of the page mirror data corresponding to the data page and the log number of the transaction log; Check whether there is a page mirror file with the same name as the file name in the disk; If it exists, repair the data page by using the page mirror data in the page mirror file.

5. The processing method according to claim 1, wherein, After the step of adding the page mirror data to the data linked list of the transaction log, it further includes: Flush the page mirror data and the data page corresponding to the page mirror data to disk in sequence.

6. The processing method according to claim 5, wherein, The step of flushing the page mirror data and the data page corresponding to the page mirror data to disk in sequence includes: Check whether there is corresponding page mirror data in the data linked list for the data page to be flushed; If it exists, construct a file name by using the table position, block number in the disk of the page mirror data corresponding to the data page and the log number of the transaction log; Check whether there is a page mirror file with the same name as the file name in the disk; If it exists, flush the page mirror file to disk; Flush the data page corresponding to the page mirror data to disk.

7. The processing method according to claim 1, wherein, After the step of flushing the page mirror file to disk, it further includes: Remove the linked list node corresponding to the page mirror data from the data linked list; Then execute the step of flushing the data page corresponding to the page mirror data to disk.

8. The processing method according to claim 1, wherein, After the step of checking whether there is header information of page data in the transaction log, it further includes: If it does not exist, check whether the transaction log has been redone completely; If so, end the redo process of the transaction log; If not, read the next transaction log to be redone.

9. A machine-readable storage medium, on which a machine-executable program is stored, and when the machine-executable program is executed by a processor, it implements the mathematical method of the database according to any one of claims 1 to 8.

10. A computer device, including 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 processing method of the database according to any one of claims 1 to 8.